jnatva tad danavendrasya
bhagavan harir isvarah
jnatva—after understanding; tat—that; danava-indrasya—of the great demon; hayagrivasya—of Hayagriva; cestitam—activity; dadhara—accepted; saphari-rupam—the form of a fish; bhagavan—the Supreme Personality of Godhead; harih—the Lord; isvarah—the supreme controller.
Understanding the acts of the great demon Hayagriva, 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