This myth was included in the Skanda Purana as an elaboration on the myth of the Churning of the Milky Ocean, in which Vishnu appeared as Mohini and tricked the asuras (demons) out of the nectar of immortality. The moral purpose of this myth is not clear. It does extend the notion that rivers are sacred.
Vishnu had taken the form of a beautiful woman called Mohini that had appeared when the Milky Ocean was churned, which had been stolen by the demons. Siva wanted to see this form of Vishnu and persuaded Vishnu to appear again as Mohini. Upon seeing her great beauty Siva made love to Mohini. The sweat that was produced during their love play fell down and turned into a river called Gandaki.