Srimad-Bhagavatam: Canto 8 - Chapter 1 - Verse 9
Sanskrit:
ज्ञात्वा तद् दानवेन्द्रस्य हयग्रीवस्य चेष्टितम् ।दधार शफरीरूपं भगवान् हरिरीश्वर: ॥ ९ ॥
ITRANS:
jñātvā tad dānavendrasyahayagrīvasya ceṣṭitamdadhāra śapharī-rūpaṁbhagavān harir īśvaraḥ
Translation:
Understanding the acts of the great demon Hayagrīva, the Supreme Personality of Godhead, Hari, who is full of all opulences, assumed the form of a fish and saved the Vedas by killing the demon.
Purport:
Because everything was inundated by water, to save the Vedas it was necessary for the Lord to assume the form of a fish.