this Avataram, Mahavishnu took the form of a fish to retrieve the vedas
from the Asura Hayagreevan (head of a horse) and also to safeguard herbs
and seeds at the end of one cycle of creation.
Brahma at the end of his day's work of creation, was resting in Brahmalogam. The vedas were flowing out of his mouth. An asura called Hayagreevan stole the vedas from Brahma and disappeared in the ocean. Without the vedas, Brahma could not continue with his duty of creation and hence Lord Vishnu took the form of a fish to retrieve the vedas.
Satyavridan was a staunch devotee of Lord Vishnu, who did severe penance, surviving by drinking only water. One day as he was performing his rituals by the riverside, a tiny fish settled in his hands. As he was about to drop it back into the river, the fish spoke out to him asking for protection from the bigger fishes in the river.
The king dropped the fish in his kamandalam (pot) and took it to his ashramam. The fish grew at a rapid pace and the king had to find bigger and bigger area of water for the fish to survive. When the king finally decided to leave it in the ocean, the fish again pleaded not to leave it at the mercy of sharks.
At this, the king worshipped the fish, aware that he must be Lord Vishnu himself. Maha Vishnu, blessed and reassured Satyavridan asking him to collect rare herbs and seeds and load them all on a huge boat. The king did as ordered. He then tied the boat to the horn of the fish (Lord Vishnu in fish form) using the snake Vaasuki as a rope. The Saptharishis shed light and guided the boat through the darkness and flood. Lord Vishnu in his fish form guided the boat and once the flood had subsided brought it to shore.
Brahma had risen from his rest and realised that the vedas were missing. He prayed to Lord Vishnu retrieve them. Lord Vishnu still in his fish form, found and fought with Hayagreevan and returned the vedas to Lord Brahma who continued with his work of creation.