O goddess, till the advent of the Kali Yuga, when the son of Vivasvat shall be the twenty-eighth Manu, you shall stay here alone.
So Ganesha approaches the sage Gautama, taking the form of a feeble cow, and starts eating Gautama's crops. To shoo the cow away, Gautama throws some blades of grass at it, but as soon as the grass touches the cow he sees it fall dead. Gautama is shocked that he has committed Gohatya (cow-killing), a supreme sin in the Hindu religion, so he takes his wife and leaves the hermitage in order to undertake an arduous course of repentance that involves circumambulating the Brahmagiri mountain,
going around confessing his sin to everyone he encounters, and making Lingams to worship Shiva. Finally Shiva appears before him, and Gautama asks to be made sinless. Shiva laughs and says that Gautama hasn't committed any sins, and that Gautama is such a great sage that even looking at him makes other people sinless. In any case, Gautama asks Shiva for Ganga to be brought there, so that he and others could be purified of their sins
So Shiva gives Gautama "the essence of the earth and heaven" which was apparently Gautama's inheritance from his father Brahma, and Gautama uses that essence to summon the goddess Ganga. Shiva tells this to Ganga:
Thank You
Ganga says that she'll only agree to stay if Shiva also stays there, so Shiva manifests himself as Tryambakeshwara (meaning the three-eyed lord), one of the twelve Jyotirlingas (Lingas that appeared after Shiva manifested as a pillar of light.)
So Ganga agrees to stay there as a new river, initially called the Gautami river but now known as the Godavari river. Gautama and his disciples bathe there to purify themselves of sin. And even the sages who tried to take revenge on Gautama are eager to get rid of the sins.Ganga is initially reluctant to purify these men who had been so cruel to Gautama, but then Gautama convinces her to relent and he digs a ditch for her to emerge from and purify the sages of their sins.
That ditch is the famous Kushavartha Thirtha at the Tryambakeshwara temple.