The Brothers: Hiranyaksha & Hiranyakashipu were brothers. Lord Vishnu in his Varaha Avatar killed Hiranyaksha. To take revenge, his brother Hiranyakashipu performed severe penance and attained a boon from Brahma - The creator.
The Boon: That he would not die either on earth or in space; nor in fire nor in water; neither during day nor at night; neither inside nor outside (of a home); nor by a human, animal or God; neither by inanimate nor by animate being.
The Terror: With virtually no fear of death, he unleashes terror. Hiranyakashipu declares himself as god and asks people not to utter god's name except his. However his son Prahlada (who is a devoted worshiper of Lord Vishnu!) refuses. Repeated pressurization on him yields no results for Hiranyakashipu. Prahlada declares the omnipresence of Lord Vishnu.
The Test: One day Hiranyakashipu points to a pillar and asks if Vishnu is present in it. Prahlada said "Yes!". His father becomes furious and draws his sword and cuts the pillar; Narasimha (The avatar of vishnu) appears out of the broken pillar.
The Victory: Narasimha (being a man-lion god form) kills Hiranyakashipu. He comes out to kill at the twilight (neither day nor night); on the doorsteps of his palace (neither inside nor outside); uses his nails to kill (neither animate nor inanimate); puts him on his lap before killing (neither earth nor in space). Thus making the power of the boon ineffective.
The Purpose: The specific purpose of this avatar was for protection of his devotee Prahlada from his demon father Hiranyakashipu, to prove a point and to make true the words of his devotee that God is in existence everywhere. Prahlada's episode proves that God will always come to the rescue of his devotees who pray him with sincere devotion.