jñātvā tad dānavendrasya
bhagavān harir īśvaraḥ
jñātvā—after understanding; tat—that; dānava-indrasya—of the great demon; hayagrīvasya—of Hayagrīva; ceṣṭitam—activity; dadhāra—accepted; śapharī-rūpam—the form of a fish; bhagavān—the Supreme Personality of Godhead; hariḥ—the Lord; īśvaraḥ—the supreme controller.
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.
Because everything was inundated by water, to save the Vedas it was necessary for the Lord to assume the form of a fish.
Link to this page: https://prabhupadabooks.com/sb/8/24/9