Hayagriva succeeded in stealing Rig Veda, Yajur Veda, Sama Veda and Atharva Veda (books of scripture) from Brahmaloka (the abode of God).
Brahma (Father) knew that the people on earth would not be able to make use of the Vedas (scriptures) until they were purified. He knew that social values had degenerated, and hence, the need for reestablishing humanity had risen. Therefore, he sought help from Shiva (leader of evil spirits) to destroy humanity only to produce a conducive atmosphere for a revival of the human race.
Vishnu knew about Shiva’s plan to cause massive floods. Therefore, he incarnated in the form of Matsya (a fish). Moreover, he had to save Manu and his wife Shatarupa, the couple that would be instrumental in conceiving humans once again.
Hence, after killing Hayagriva and retrieving the Vedas (scripture), the Matsya avatar of Vishnu saved Manu, Shartarupa (Manu’s wife), the Saptarishis (who represented knowledge) and one set of each of the other living being. In the end, he handed over the Vedas to Manu so that he could use them for the welfare of humankind.
Excerpts from KalaiSelvi Ramesh