The story of Narasimha as described in the Bhagavata Purana (voluminous work in Sanskrit dealing with aspects of ancient Indian history, legend and mythology) is as follows:
In his previous Varaha Avatara Vishnu killed the demon Hiranyaksha. His brother Hiranyakashipu, infuriated by this incidence began to detest Lord Vishnu and his followers. His sole mission was to kill Vishnu by acquiring mystical power through years of austere penance. Brahma, chief of the deities pleased by Hiranyakashipu's austerities appeared, offering him a boon to personally fulfill anything he wished for. Hiranyakashipu was eagerly desirous to be practically immortal:
“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. Grant me, further, that I not be killed by any demigod or demon or by any great snake from the lower planets. Grant me the benediction that I too may have no rival. Give me sole lordship over all the living entities and presiding deities. Furthermore, give me all the mystic powers attained by long austerities.”
One day while Hiranyakashipu was doing penance at Mandaracala Mountain, his home was attacked by Devraj Indra and other deities seizing the opportunity of his absence. At this point of time sage Narada intervened to protect Kayadu, who he described as 'sinless' and sheltered her in his ashram. Under the guidance of Narada, her unborn child Prahlada, Hiranyakahipu’s son, was moved by the transcendental instructions of the sage. On growing up Prahlada influenced by this earlier training of Narada, was gradually recognized as a dedicated devotee of Vishnu, much to his father's disappointment.
Finally Hiranyakashipu infuriated at his son's devotion to Vishnu, his rival, resolved to kill Prahlada. He tried throwing him down a mountain, drowning him and poisoning him. However each time round his diabolic attempt was foiled by Vishnu's innate divinity. Prahlada refusing to acknowledge his father supremacy over the universe, claimed Vishnu as the all-pervading preserver.
Finally Hiranyakashipu pointed to a nearby pillar and asked, "O most unfortunate Prahlada, 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?" He heated an iron pillar and commanded his son to embrace it.
Prahlada then answered, “He was, He is and He will be” and instantly wrapped his arms around the pillar which did not sear him.
Enraged, Hiranyakashipu smashed the pillar with his mace. Soon enough a tumultuous sound heralded the manifestation of Vishnu as Narasimha springing from the pillar and in quick defense of Prahlada attacked his father. Hiranyakashipu could not be killed by a human, deity or animal, as per Brahma’s boon so Narasimha incarnated as a part-human, part-lion. He struck Hiranyakashipu at twilight (when it is neither day nor night) on the threshold of a courtyard (neither indoors nor out), and tore the demon apart on his thighs (neither earth nor space). Using his sharp claws as weapons, he killed the demonic force. The Kurma Purana details the preceding battle in which he escapes pashupata, a powerful weapon and describes how Prahlada’s brothers headed by Anuhrada and thousands of demons were led to the valley of death (yamalayam) by the man-lion avatara. The same episode is related in the Matshya Purana 179, several chapters after its version of the Narasimha advent.
Even on killing Hiranyakashipu none of the present demigods could placate Narasimha's fury, not even Shiva. All the gods and goddesses entreated goddess Lakshmi, his consort, to placate him but in vain. Finally at the request of Brahma, Prahlada was presented to Narasimha who was eventually calmed by the prayers of his dedicated devotee. Before leaving for his divine realm, Narasimha rewarded the wise Prahlada by declaring him king.
Based on this story, followers firmly believe that Narasimha inevitably protects his sincere devotees when they are in grave danger. He saved Adi Sankara from being sacrificed to the goddess Kali by a Kapalika. Thus Adi Sankara composed the Lakshmi-Narasimha stotra or panegyrist.