In the chapter 3-4 in Section 4 of Kotirudra-saṃhita of Shiva Purana, the story of Anasuya & Atri is told.
Atri was the son of Brahma & great sage of perfect knowledge. There was severe drought for very long period. Anasuya, the wife of Atri said to her husband, “I cannot bear the distress of living beings. Atri sat in yogic pose and the meditated-on Shiva through his own soul. Anasuya made a beautiful clay image through mantras in accordance with the rules, she worshipped Shiva through mental modes of service. After serving Shiva repeatedly she eulogised him with devotion.
Anasuya circumambulated her lord and Shiva. After prostration she went round anticlockwise too. On seeing that beautiful lady, the Daityas and Danavas were excessively agitated by her brilliance. They kept themselves away as people do from a blazing fire.
As long as the sage was engrossed in Praṇayama, the gentle lady continued her service. The couple thus engaged in their activities remained there, alone. On account of his penance and her worship the gods and the sages, Ganga and the rivers came there in order to see them with pleasure. On seeing his penance and her service they were surprised. On seeing their wonderful activity, they asked one another. “Which of the two—the penance or the service, is the greater?” They themselves replied — “Arti’s penance is good but Anasuya’s service is better”. Others said “Difficult penances had been performed by sages of yore but nothing like Dadhici’s penance was ever performed by any”. After praising them thus, they went away but only Ganga and Shiva were left.
Ganga said: — “Delighted in worshipping us the chaste lady is too much engrossed in virtuous rites. I shall help her and then go.” Shiva too, drawn by the meditation of Atri, stationed himself there in full digits. He did not go to Kailash. Anasuya decided pot to eat anything.
Once that great sage Atri woke up and spoke to his wife “Give me water.” Of course, the chaste lady took the water pot and went into the forest. (But she began to muse) “Whence can I fetch water? What shall I do? Where shall I go? How can water be fetched?” Wondering thus she saw Ganga. By the time she went over to her, Gaṅgā, the most excellent river, assumed a beautiful form and spoke to her.
Ganga said: — “O gentle lady, I am delighted with you. Where are you going? Tell me now. O fortunate lady, you are blessed. I shall truly carry out your behest.”
On hearing her words, the wife of the sage, was greatly surprised. She replied with great pleasure: O beautiful lady with eyes like lotus-petals, whence have you come? Please tell me the truth.
Ganga said: — “O chaste lady, on seeing the service rendered by you unto your lord and to Shiva the great soul and on taking view of your holy rites, I am staying near you. I am Ganga come here attracted by your worship. Choose whatever you wish.”
On hearing what Ganga said, the chaste lady bowed to her and said— “If you are pleased madam, give me water now.”
On hearing her words Ganga said— “Dig a pit.” She then made a pit in a trice, came and stood before her. Ganga entered the pit which became full of water in surprise, Anasuya took the water and said: - “If you are delighted, if you have sympathy for me, you will please stay here till my husband comes.”
The delighted Ganga said— “O sinless lady, you will give my water to Atri.” When Ganga said thus, Anasuya acted accordingly. She gave the divine water to her lord and stood before him. The sage performed the Achamana duly with great pleasure and drank the divine water. On drinking it he derived great happiness.
“O this is not the water usually drunk by me.” After thinking thus, he suddenly looked all round. On seeing the trees dry and withered and the quarters rough and arid, the excellent sage spoke to her “No rain has fallen?” On hearing what he said, the beloved lady replied in the negative. He then asked her whence she brought that water for him.
When he said this, Anasuya was much surprised. She then thought within herself. “If I tell him the truth it will be the exhibition of my greatness. If I do not tell him, it will be a violation of my rites. I shall tell him in a manner to avoid the contingencies. Even as she was musing thus, she was asked again and again. “O lord, please hear me. I shall tell you what has happened.” Anasuya said: --
“Thanks to the power of Shiva and you merit, Ganga has come here herself. This is her water, to be sure.”
On hearing this, the sage was surprised in his mind. Remembering Shiva mentally he spoke to his beloved with great pleasure. Atri said: — “O beautiful lady, whether you speak truth or lie, I cannot believe it. This is something rare. If I see that myself, I shall believe it, not otherwise.”
On hearing his words, the beloved wife spoke to the husband: — “O lord, please come with me if you wish to see Ganga, the foremost among the rivers.” After saying this and remembering Shiva, the chaste lady took her husband to the place where Ganga was present. Going there and seeing the beautiful pit full to the brim with water, the excellent sage said— “She is blessed.” “Is this the fruit of my own penance or of somebody else?” After saying this the leading sage eulogised her with devotion. Then the sage took a clean bath in that excellent water. The sage performed the routine rites. Anasuya too, of good rites, performed likewise. Then Ganga told her “I am returning to my place.” When this was said, the chaste lady spoke to the leading river again.
Anasuya said: — “O goddess if you are delighted, if you are kind to me, you will stay in this penance-grove for ever.”
The sage said likewise— “O leading river, you shall stay. O goddess, be favourable to us and bless us with your support.” On hearing his pleasing words, the leading river Ganga was delighted in her mind and spoke to Anasuya. Ganga said: — “I shall stay back for helping the gods if you pass on to me a year’s merit accruing to you by worshipping lord Shiva. I am not so much satisfied with charitable gifts, or ceremonial ablutions in the holy centres or sacrifices or the practice of Yogic rites as I am satisfied with chastity. If you seek for welfare, you give up that merit for the benefit of the world, then I shall become steady and stable here.”
On hearing these words, the chaste Anasuya passed on a year’s merit to Ganga. On seeing this performance of Anasuya, a chaste woman, Lord Shiva was delighted and appeared out of his earthen phallic form. Shiva said: --
“O chaste lady, on seeing this activity of yours I am delighted. Mention the boon you wish to choose, since I am very fond of you.”
Then the couple glanced at the wonderfully beautiful form of Shiva. On seeing five-faced Shiva they were much surprised. Bowing to and eulogising Shiva, the benefactor of the worlds, the couple endowed with great devotion spoke to him after worshipping him. The couple said: --
“O lord of gods, if you are delighted, if the mother of the universe is also delighted, please stay in this penance-grove and be the bestower of happiness to the worlds.”
Then the river Ganga was delighted. Shiva too was pleased. They stayed at the hermitage of the excellent sage. Lord Shiva, the destroyer of miseries was known as Atrishvara. Ganga too stayed in the pit by her magical power. Thence onwards there is a perennial supply of water in that pit deep only by a hand’s length. Ganga flows gently there.
Chastity is much better than giving charitable gifts, or ceremonial ablutions in the holy centres or sacrifices or the practice of Yogic rites.