In the chapter 26, Section 3 of Satarudra Samhita of Shiva Purana, the story of incarnation of Shiva as Vaishyanatha is mentioned.
Formerly, in Nandigrama there was a prostitute known as Mahananda. She was very beautiful and a devotee of Shiva. She was very prosperous, rich and brilliant. She was bedecked in gems of different kinds. She was voluptuous in love. She was an adept in all lore of music. Queens and kings were delighted by her songs. She always worshipped Shiva and Parvati with great joy. She was interested in recounting the names of Shiva. She used to wear ashes and Rudrakṣa.
After worshipping Shiva, she used to dance with great devotion and sing the great glory of Shiva. She kept a monkey and a cock which she decorated with Rudrakṣas. She made them dance singing herself and clapping her hands. On seeing them dance, she, engrossed in devotion to Shiva, used to laugh lovingly along with her friends and attendants. The monkey, as a result of her instruction, danced before her, like a boy bedecked in Rudrakṣas as ear-rings, and shoulder-lets. The cock too was bedecked in Rudrakṣa tied round its tuft. It too danced along with the monkey delighting the onlookers. Thus, that prostitute indulging in these delightful pranks and pursuing devotional service to Shiva was very happy always.
Once Shiva assumed the form of a merchant and visited her house to test her. He had assumed the auspicious form of a devotee. His forehead was marked with Tripuṇḍra. He wore Rudrakṣa as ornaments. He was interested in recounting the names of Shiva. He was clad as a devotee of Shiva. He wore matted locks of hair. He had smeared ashes all over his body. Round his wrist was tied an excellent bangle set with gems.
The beautiful prostitute worshipped and welcomed the visitor with great joy. She made him sit with great respect. On seeing the excellent bangle round his wrist, she coveted the same.
She wished for the bangle set with nine gems. Vaishyanatha said: — “If your mind wishes for this excellent gem set ornament you can have it with pleasure. But what is the price you are willing to pay?”
The prostitute said: —"We are prostitutes flirting here and there and not chaste ladies. Undoubtedly the regular practice observed in our family is harlotry. If I take the bangle from you, I shall be your wife for three full days and nights.”
The merchant said: — “if your words are true, let it be as you say. I shall give you the gemset bangle. Be my wife for three days and nights. In this deal the witnesses are the moon and the sun. Repeat three times “True” and touch my heart.”
The prostitute said: —"I shall be your wife for three days and carry out all wifely duties. This is true. This is undoubtedly true.”
After repeating this for three times, with the moon and the sun as witnesses, Mahananda touched his heart with pleasure. After giving her the gem set bangle that merchant handed to her a gem set phallic image and spoke: - “this gem set phallic image is very dear to me. It shall be well-preserved strenuously and in secret by you.”
She said “Let it be so” and took the gem set phallic image. She kept it in the middle of the dancing platform and entered the house.
At midnight, suddenly there arose a fire in the middle of the dancing platform. The blazing fire helped by a forceful wind enveloped the dancing platform all of a sudden. When the platform was burning the prostitute got up suddenly in her bewilderment and let the monkey free untying it. Freed from the bondage the monkey in its fear ran here and there along with the cock and scattered sparks of fire. On seeing the phallic image burnt along with the pillar and smashed utterly, the prostitute and the merchant felt endless distress. On seeing the phallic image as it were his very soul burnt, the lordly merchant desired to end his life in order to know her mentality.
In great despair and sorrow the merchant told her in grief. Lord Shiva who had assumed a human body just for pleasure indulged in different sports. “O my beloved, when the phallic image is smashed and burnt, I do not desire to live. O gentle lady, prepare a pyre for me immediately through your servants. With my mind fixed in Shiva, I shall enter the fire.
On realising his tenacious decision, she was much distressed. Outside her house she caused the pyre to be made through her servants. Then the merchant who was only Shiva himself went round the blazing fire. Desirous of knowing her intentions he entered the fire firmly. on seeing him enter the pyre, the youthful maiden sympathised with him.
Mahananda said: —"Taking the gem set bangle I had taken the pledge that I shall be the avowed wife of this merchant for three days. This merchant, the avowed Shaivite, died of my activities. Hence, I shall enter fire along with him.”
Truthfully preceptors have ordained that a wife shall observe her duty. If I do likewise my truthfulness will not be marred. Abiding by truth is a great virtue. Great goal can be attained through truth. Heaven and liberation can be achieved through truth. Everything is founded on truth.
Although prevented by her kinsmen, she was obstinate in her resolve. The woman eager in the attainment of Satyaloka decided on giving up her life. She gifted away her property to leading brahmins. She meditated on Sadashiva. She circumambulated the fire thrice and stood ready to enter it. As she was going to jump in the fire with her mind fixed in his feet, Shiva, the soul of the universe, appeared in front and stopped her. On seeing the three-eyed lord of the gods, decorated by the moon’s digit, and as brilliant as crores of moons, suns and fires she stood as If stunned and frightened. The lord caught hold of the hands of the frightened and agitated lady, stunned, trembling and shedding (ears. He consoled her and spoke.
Shiva said: —"It is to test your truthfulness, piety, courage and steady devotion to me that I came near you assuming the form of a merchant. With my magic I produced the blazing fire and burnt your dancing platform. After burning the gem set phallic image, I entered fire myself. But you remembered the promise and entered the fire along with me. Hence, I shall give you such pleasures as are inaccessible to gods. Whatever you wish I shall give you. I am delighted by your devotion.”
This prostitute said: —"I have no desire for enjoyment on the earth, in the heaven or in the nether worlds. I do not desire anything except the touch of your lotus-like feet. My servants, my maids and my kinsmen are interested in seeing you. They have dedicated everything to you. Take them all along with me to your great region and quash the terrible fear of rebirth. Obeisance be to you.”
Appreciating her words, the great Shiva took all of them to his great region.