Once upon a time, Brahma, the creator of the cosmos, was fast asleep. At that moment, an asura known as Hayagriva (meaning horse-headed) crawled out of his nose. True to his nature, Hayagriva, the asura, had some tricks up his sleeve. The four Vedas, owned by Brahma, a hub of immense knowledge, which he intended to share with humanity.
Hayagriva, however, did not want this to happen. So, he stole the Vedas, to avoid humanity benefitting from them, and eventually become powerful.
He plunged the four Vedas, deep in to the ocean, thinking that nobody would find him there. In order to save the Vedas, Vishnu took the avatar of Matsya, the fish. He swam to the bottom of the ocean, retrieved the Vedas and also slayed the asura.