Very briefly, this avatar was taken to retrieve the Vedas which had been stolen by Hayagriva, when the creator Brahma went into slumber. The Lord took the form of a big whale to restore the Vedas after slaying the demon Hayagriva and taught the Puranas dealing with Brahma to Satyavratha (a royal sage son of Vivaswin, exalted to the position of Manu by the Lord) and other seers.
The story goes thus:
One day when Sathyavratha was offering water to the horses standing on the bank of river Krantamala, he found a small fish in the hollow of his palm containing water. When he dropped the fish, it requested Sathyavratha to protect it. Thereupon he put it into the vessel of water he had brought along with him (kamandala). There it grew and again requested Sathyavratha to place it in such a place where it can comfortably live. Then Sathyavratha transferred it to a pitcher; there also it grew. Thus Sathyavratha went on transferring the fish from the pitcher to a pond, from a pond to a lake and from a lake to several lakes as the fish went on growing wherever it was placed. Hence, finally it was thrown into the ocean. The fish pleaded with Sathyavratha not to leave it alone, as it was afraid of alligators. Sathyavratha realised that it was not an ordinary fish; it was the Lord himself taking the form of a fish for a particular purpose. He then beseeched the Lord to tell him the true facts.
The Lord pleased by this, told Sathyavratha that on the seventh day all the three lokas (Bhooloka, Bhoovarloka and the ocean) will be in deluge and at that time a mysterious boat will come floating. He then directed Sathyavratha to board the vessels with all types of seeds, herbs and animal plants and attach the boat by means of serpent snake to his horn. Eventually when the golden whale with thorns was perceived by Sathyavratha, he did as directed by the Lord.
Sathyavratha was taught Puranic lore mysteries (Matsya Putana), while on board the vessel. The Lord then handed over the restored Vedas after killing Hayagriva to Brahma who woke up from his slumber at the end of Pralaya. Sathyavratha also called Sraddhadevas was bestowed with spiritual knowledge and wisdom by Lord Vishnu himself.