There was an unusually hot summer prevailing in South India and Sage Agastya went to mount Kailas to ask Lord Shiva for water. Kaveri happened to be worshipping Shiva at that time.
Shiva picked her up and put her in Agastya’s kamandalu.
The sage thanked his benefactor and set out for home.
Indra did not approve of what Shiva had done and requested Ganpati to somehow overturn Agastya’s kamandalu.
Ganpati took the form of a crow and when Agastya kept the vessel down swooped down, and sat on its rim. The vessel overturned and Kaveri flowed out.
Agastya was very angry but calmed down when Ganpati revealed his true form.
Ganpati refilled Agastya’s kamandalu, but Kaveri flowed on and continues to flow to this day.