In his previous avatar as Varaha, Lord Vishnu killed the raksha Hiranyaksha. The brother of Hiranyaksha, Hiranyakashipu, wanted revenge on Vishnu and his followers. He undertook many years of austere penance to take revenge on Vishnu. Brahma thus offers the demon a boon and Hiranyakashipu asks for immortality. Brahma tells him this is not possible, but that he could bind the death of Hiranyakashipu with conditions. Hiranyakashipu agreed:
O my lord, O best of the givers of benediction, if you will kindly grant me the benediction I desire, please let me not meet death from any of the living entities created by you. Grant me that I not die within any residence or outside any residence, during the daytime or at night, nor on the ground or in the sky. Grant me that my death not be brought about by any weapon, nor by any human being or animal. Grant me that I not meet death from any entity, living or nonliving created by you. Grant me, further, that I not be killed by any demigod or demon or by any great snake from the lower planets. Since no one can kill you in the battlefield, you have no competitor. Therefore, grant me the benediction that I too may have no rival. Give me sole lordship over all the living entities and presiding deities, and give me all the glories obtained by that position. Furthermore, give me all the mystic powers attained by long austerities and the practice of yoga, for these cannot be lost at any time. Brahma said, “Tatha asthu” and vanished. Hiranyakashipu was happy thinking that he had won over death.
One day while Hiranyakashipu performed austerities at Mandaracala Mountain, his home was attacked by Indra and the other devatas. At this point the divine sage Narad intervenes to protect Kayadu, whom he describes as ‘sinless’. Following this event, Narad takes Kayadu into his care and while under the guidance of Narad, her unborn child (Hiranyakashipu’s son) Prahlad, becomes affected by the transcendental instructions of the sage even at such a young stage of development. Thus, Prahlad later begins to show symptoms of this earlier training by Narad, gradually becoming recognised as a devoted follower of Vishnu, much to his father’s disappointment.
Once Holika, sister of Hiranyakashipu, tried to kill Prahlad because he was worshipping the enemy of Daitya-Kul, so she sat on fire taking Prahalad on her lap. She was granted a boon from Lord Shiv that she would remain unaffected by Agni(fire). But by the grace of the supreme personality of Godhead,Lord Vishnu she burnt into ashes while Prahlad remain unaffected.
Hiranyakashipu furious at the devotion of his son to Vishnu, as the god had killed his sister. Finally, he decides to commit filicide but each time he attempts to kill the boy, Prahlad is protected by Lord Vishnu’s maya. When asked, Prahlad refuses to acknowledge his father as the supreme lord of the universe and claims that Hari is all-pervading and omnipresent. Hiranyakashipu points to a nearby pillar and asks if ‘his Narayan’ is in it:
“O most unfortunate Prahlad, you have always described a supreme being other than me, a supreme being who is above everything, who is the controller of everyone, and who is all-pervading. But where is He? If He is everywhere, then why is He not present before me in this pillar?”
Prahlad then answers, He was, He is and He will be, he is present everywhere, in every being, in me and in you as well. Hiranyakashipu, unable to control his anger, smashes the pillar with his mace, and following a tumultuous sound, Vishnu in the form of Narasimha appears from it and moves to attack Hiranyakashipu. in defence of Prahlad. In order to kill Hiranyakashipu and not upset the boon given by Brahma, the form of Narasimha is chosen. Though Lord Narayan could have killed him the other way but to keep the boon of the demi-gods respectful he acquire that avatar. Narasimha is neither one of these as he is a form of Vishnu incarnate as a part-human, part-animal. He comes upon Hiranyakashipu at twilight (when it is neither day nor night) on the threshold of a courtyard(neither indoors nor out), and puts the demon on his thighs (neither earth nor space). Using his sharp fingernails (neither animate nor inanimate) as weapons, he disembowels and kills the demon.
There is a movie Hari Darshan depicting the whole story very well;
Even after killing Hiranyakashipu, none of the present demigods are able to calm Narasimha’s fury, not even Lord Shiva. So all the gods and goddesses call his consort, Lakshmi, but she is also unable to do so. Then, at the request of Brahma, Prahlad is presented to Narasimha, and finally he is calmed by the prayers of his devotee. Before parting, Narasimha rewards the wise Prahlad by crowning him as the king.
ऋतग्ं स॒त्यं प॑रं ब्र॒ह्म॒ पु॒रुषं॑ कृष्ण॒पिङ्ग॑लम् ।
ऊ॒र्ध्वरे॑तं वि॑रूपा॑क्षं॒ वि॒श्वरू॑पाय॒ वै नमो॒ नमः॑ ॥
ॐ ना॒रा॒य॒णाय॑ वि॒द्महे॑ वासुदे॒वाय॑ धीमहि ।
तन्नो॑ विष्णुः प्रचो॒दया॓त् ॥
ॐ शान्तिः॒ शान्तिः॒ शान्तिः॑ ।