It appears in Bala Kanda of Valmiki Ramayana.
After descending from Heaven on the head of Shiva and from there to Earth, Ganga started following the course Bhagiratha took.
As she inundated the field, where Sage Jahnu was performing a Vedic ritual, the latter got angry and drank the entire water of Ganga.
ततो हि यजमानस्य जह्नोरद्भुतकर्मणः ||१-४३-३४ गङ्गा संप्लावयामास
यज्ञवाटं महत्मनः |
While in flow she started to completely inundate the field of
Vedic-ritual belonging to the great-souled sage Jahnu, who is of
marvellous deeds and who is presently an officiator of an ongoing
Vedic-ritual.
तस्यावलेपनं ज्ञात्वा क्रुद्धो जह्नुश्च राघव || १-४३-३५ अपिबत्तु जलं
सर्वं गङ्गायाः परमाद्भुतम् |
But on knowing her hubris, oh, Raghava, that sage Jahnu has become
irritated and causing an extreme marvel he drank off all the water of
Ganga.