The Hayagriva Avataram occurred after the Prakrita Pralayam (cosmic dissolution). This Prakrita Pralayam is when all kinds of Lokas (worlds) get destroyed and merge back into the Mulaprakriti (primordial nature), and all the Jeevas (souls) also merge into the Supreme Being. After that, when Perumal starts the Srishti (creation) again, Lord Brahma does the creation, and Vishnu imparts the Vedas to him. Those Vedas were stolen by Madhu-Kaitabha. The Madhu-Kaitabha emerged from the earwax of Perumal, and it seems there were no other creations at that point. During this time was the Hayagriva avataram.
Then there is another type of Pralaya called Naimittika Pralaya. In this, not all the worlds are destroyed; only some worlds are affected. After that, the creation of the destroyed worlds continues. During this period, the Dashavataram (Ten incarnations) that occurs every Chaturyugam takes place. One of those incarnations is the Matsya avatara. In the Bhagavatham, it is stated that at the conclusion of the Chakshusa Manvantharam (era) and the beginning of Vaivasvata Manvantharam, a commentary of Matsya avataram is found. It says that the destruction is not complete. During the time of the seventh Vaivasvata Manvantaram (era), a great flood will come, and the Saptarishis (seven sages) will get into a boat arranged by Satyavrata Pandiyan to cross the flood. Those who are eligible and qualified for the next Manvantaram will be protected in the boat. Also, to protect the Vedas for the next era, the Supreme Being takes the Matsya Avataram. Hayagriva, the asura, steals and takes away those Vedas. He is killed by Matsya murti and recovers the Vedas. This is the story. However, it should be understood that the Hayagriva Asuran and Hayagriva Avataram occurred in two different periods.

