Hayagriva was a very powerful demon and was causing a lot of trouble to the Devas and others as was wont with the Asuras. Brahma's (the creator's) day and night - each comprises several million years unlike our day and night. When Brahma's day is over he goes to sleep having been busy all through with continuous work. This is said to be the the end of a very long period of time. When he goes to sleep utter darkness prevails and the earth will be submerged in water. It is called the Deluge. This continues throughout Brahma's night and again it is a very long period of time. After many many thousands of years of darkness and deluge the earth slowly comes out of the water as the water too begins to recede slowly.
It is at this time the horse-headed demon Hayagriva conspired with his evil friends and decided to take away the Vedas. He knew that the Pralaya or the deluge was to come and all living beings including plant life would be exterminated. The Vedas were the breath of the Devas, Sages and all virtuous people and because of the Vedas they were able to reset the Asuras and were always having an upper hand. So he decided to carry away the Vedas without anyone's knowledge as soon as Brahma began to sleep. (The four Vedas were given to us by Brahma - the Creator). With the Vedas in his possession Hayagriva wanted to hide himself in some deepest abyss appear as before and not finding the Vedas, the Devas, and the Sages would be utterly powerless. At such thought he heaved a sigh of great relief and was waiting for the night of Brahma to come.
At that time a great royal sage by name Satyavarta was performing penance, absolutely devoted to Lord Narayana sustaining himself only on water, observing severe austerities.
Once Satyavarta was offering water libation in the Kritamala river. When he took water in his hand for this purpose there came a tiny fish with the water into his hand. The good Satyavarta put the fish into his small water-pot out of compassion and went to his abode. Next morning when the Rajarishi took his water-pot, he saw the tiny fish had grown to the size of the pitcher. Wondering at this the good Satyavarta put the fish in a big tub. To his wonder he saw the fish growing bigger and bigger occupying the entire tub. The fish now spoke and said "O! good king show mercy on me". So the good Satyavarta took the fish and put it in a big well nearby and went for his work. Next morning he went to the well and saw the fish occupying the whole well. He was really confused. But out of pity he removed it carefully to a big lake nearby. To his consternation he observed the fish growing and in a short time occupied the entire lake.
No more patience had the Rajarishi, so he asked the fish "Who are you that bewilder us in the form of a fish? You must be only Lord Narayana in this form". The fish replied, "I am pleased with you. I am a friend of man. Listen to me. Brahma's night is coming in seven days. That means, there will be pitch darkness. The sky will open out and there will be severe downpour - a great and unprecedented flood will come. All the three worlds will be covered with water. All the mountains will be under water. Everything will perish unless suitable steps are taken in time. I have come to warn you of this great deluge. I also want to instruct you as to what you should do to save the species of men, animals and plant life from extinction. Mark my words! Keep a few human species, a few animal species, and some seeds of plant life besides the seven sages (Saptarishis). When the deluge comes the three worlds will begin to disappear in the vast waters. At that time a spacious boat will be seen approaching you. Get into the boat with all the creatures and the boat will sail down the Ganges. When it reaches the sea give me a call. I shall appear before you with an elongated nose portion. Tie the boat to my nose without waste of time. By that time the gale, the wind, the storm and the heavy downpour will increase to an unimaginable degree. Have no fears. I shall drag you along with the inmates of the boat on the turbulent water and be moving about till Brahma's night comes to an end. When Brahma's day begins the water will begin to recede and slowly the world will begin to appear. In course of time the samples of men, animals and plants will be useful to fill the land again with their respective species, of course the seven sages will be of great help". Saying so Lord Hari in the form of the fish vanished.
The king awaited that time contemplating on the Lord. On the seventh day the ocean began to rise. There was heavy downpour of rain. The world was engulfed. While he was ruminating over the command of the Lord, Satyavarta beheld the huge boat approach. He got into the boat with the sages the medical herbs, men and animals. As instructed, he called Lord Hari. There appeared in the vast expanse of water a golden fish of an extraordinary size, with an elongated nose almost looking like a tusk. He tied the boat to it. The boat moved on. The wind, the gale, the high waves, the downpour - nothing affected the boat. It was just moving while the Lord in the form of the fish imparted to Satyavarta the eternal truth as well as Matsya Purana and all things connected with the secret knowledge of the soul.
As soon as darkness fell and Brahma closed his eyes Hayagriva stole the Vedas from the creator and found his place of hiding in some deepest part of the ocean. As it was a deluge and the whole world was under water, he thought no one could find out his place of hiding. He chuckled within himself thinking that he had destroyed the Devas, Sages, and all virtuous men in all the three worlds, for such men cannot do anything without the Vedas.
Time passed on the floods subsided. Lord Hari in the form of the great fish was able to find the Hayagriva in his hiding place. A terrible fight ensued. The Lord killed him and took possession of the Vedas. He restored it to the proper person that is Brahman for the benefit of the three worlds. Brahma too had risen from his slumber by that time.
Satyavarta was there safe in his boat with all the precious things. Men, animals and plants flourished once more. By the Grace of Lord Vishnu the Rajarishi Satyavarta came to possess knowledge and spiritual wisdom. It is he who became Manu - the son of Vivasavan in the next a eon-age. "In the act of searching for the Vedas in the unfathomable depths of the ocean, Lord Hari who has taken the form of a huge fish, throws out his glances here and there and everywhere moving fast in the water. The eyes of the fish look like lotus flowers and because of the rapidity of movement the entire area of the ocean seems to be covered with blossomed lotuses. At the same time because of the movement of the fish the still water being disturbed produces light movement forming light waves which in turn is like the mild swing of a cradle".