The story of Incarnation as Agnishvara -Shiva Purana
In the chapters 13-15, Section 3 of Satarudra–Samhita of Shiva Purana, the incarnation of Shiva as Agnishvara is mentioned.
In the city of Dharmapura on the banks of river Narmada, a sage, devotee of Shiva, Vishvanara lived. He became the lord of Agniloka. While in the stage of celibacy, he was devoted to Brahma yajna rites. He belonged to the Saṇḍilya lineage. He was pure, the storehouse of Brahminical splendour and had self-control. He followed the conduct of the virtuous. He was highly skilled in Shiva ethics. He was the foremost among the knowers of worldly conventions. He married with due rites the daughter of Kala who was really worthy of him. He maintained the sacrificial fires. He was devoted to the performance of the five daily sacrifices (Brahma Yajna - “homage to Brahman or the Vedas or the sages”; Deva Yajna-"homage to Gods and elementals."; Pitri Yajna-"homage to ancestors" Bhuta Yajna-"homage to beings"; and Manushya Yajna-"homage to men").
He practised the six sacred rites every day. He was fond of serving gods, manes and guests. His wife, Sucsmati requested him to give me a son equal to Lord Shiva. After consoling his wife, the sage set out for penance to the city of Varanasi where Lord Shiva himself is stationed. Reaching Varanasi immediately and seeing Maṇikarṇika, he was freed from three distresses acquired in the course of hundreds of births. He performed ablutions in all holy ditches, wells, tanks and lakes. He bowed to all Vinayakas and Sarva Gauri. He worshipped Kalaraja Bhairava who devours sins and eulogised Daṇḍanayaka and other Gaṇas, Adikeshava and others. He propitiated Keshava. He satiated sages and brahmins by means of “feeding thousand” and other rites. With devotion he propitiated the phallic images of Shiva by means of great worship and service. He performed the wonderful penance for full year by worshipping the excellent Viresa form of Shiva thrice a day who confers the blessings of a son immediately. On the thirteenth month while he was going to Viresa after taking bath in the Ganga River very early in the morning, the sage saw a child of eight years smeared with ashes all over the body, in the middle of the phallic image. On seeing him he was joyous and eulogised Shiva by various means. After eulogising thus, when the brahmin fell on the ground with the joined hands, the boy became the aged of the aged and spoke delightedly to the brahmin. Shiva in form of the boy blessed him that he shall become your son in Sucṣmati. I shall be known as Gṛhapati, pure and loved by all gods.
With great delight the brahmin returned home and told his beloved wife all those details. She became pregnant in due course. When the Lagna was auspicious, when the good planets stood in pairs, Shiva, the giver of happiness to all, was born as the son of Sucṣmati. Brahma, Vishnu, sages, gods, nagas, thousands of immobile beings came there in the forms of the mobile beings. Brahma himself performed the postnatal rite. After conferring blessings on everyone by reciting the mantras from the four Vedas, Brahma left the place.
In his ninth year, Narada came there to see Gṛhapati and informed that this boy who has all good qualities, who is characterised by all good features and who is possessed of all pure digits in their entirety. This child should be protected with all efforts. When the fate is adverse, even good qualities assume the state of defects. In the twelfth month from now I suspect a great danger to him from lightning and fire.” After saying this Narada returned to heaven the way he had come. Both parents lamented much. On hearing their lamentation, Grhapati, a part of Shiva assured them to propitiate lord Shiva to avert any of mishappening. He secured the permission of his parents and left for Kashi. He reached Kashi and worshipped phallic image with great penance. In the twelfth year of his life, the thunderbolt, armed Indra approached him as if fulfilling the utterance of Narada and asked him to seek a boon. Gṛhapati said: — “O Indra, I know you as armed with the thunderbolt. I do not want a boon from you. Shiva is the granter of boon to me.” Indra said: — “O child, Shiva is not separate from me. I am the lord of gods. Give up your foolhardiness and ask for a boon from me.” Gṛhapati said: — “O wicked one, O enemy of mountains, O chastiser of Paka, it is quite clear that I shall not ask any other god except Shiva for a boon.”
On hearing his words, lndra’s eyes turned red with fury. He raised his terrible thunderbolt and threatened the boy with dire consequences. On seeing the thunderbolt with the flames of lightning, the boy remembered the words of Narada. He became frightened and fell into a swoon. Then Shiva, the dispeller of darkness appeared in front. As though enlivening him with gentle stroking he said: — “Stand up. Stand up. May good come up to you.”
Seeing the lord with the eyes in the fore-head, blue-necked, bull-bannered, moon-crested, with Parvati occupying the left side, shining with matted hair, armed with the trident and Ajagava bow, possessed of limbs shining white like camphor, clad in the elephant’s hide, he recognised the lord as the great God described in the Agamas and statements of his preceptor. He was delighted and he evinced the thrill of hair. For a moment he stood motionless like the mountain Chitrakuta. He forgot himself like a man suddenly becoming rich. He was unable to eulogise or bow down or plead for anything. Then Shiva smiled and spoke. Shiva said: — “O child Gṛhapati, I know that you are frightened of Indra with the thunderbolt in his lifted hand. Don’t be afraid, I only wanted to know your nature. Neither Indra, nor the thunderbolt, nor even the god of death is powerful to molest my devotee. You have been terrified by me alone in the form of Indra. O gentle one, I shall grant you the boon. I confer the title of Agni on you. I authorise you to grant boons to whatever deity you think fit. O Agni, you will be moving in the midst of all mortals. Acquire kingship as the guardian of the quarter in the south-east. The phallic image installed by you will be known by your name. It will be known as Agnisvara and it will be conducive to the enhancement of all splendor.”
After saying this Shiva entered his phallic image.
A person who worships Agnisvara, the bestower of prosperity, at Varanasi, is honoured in the region of fire even if, by chance, he dies elsewhere.