The story of Onam festival is associated with the Vamana incarnation of Vishnu and King Mahabali (Mavelio). Onam, the most popular festival in Kerala, is the day when the legendary Asura king Mahabali visits his subjects. Mahabali had turned his kingdom into a virtual paradise on earth and the ‘devas’ could not tolerate this and they sought the help of Lord Vishnu to eliminate Maveli. Onam is perhaps a rare Hindu festival in which Lord Vishnu, the vanquisher, is the villain and the vanquished King Mahabali the hero.
As per Puranas, the Asura or demon King Mahabali made the utopian kingdom a reality. His fame spread all over the earth and the netherworld and slowly into the heaven.
Indra, the king of Devas and the ruler of heaven, felt threatened by the growing popularity of Mahabali.
Aditi, the mother of Indra, observed a penance called 'payovrata' to help her son and pleased with her devotion Lord Vishnu was born as Vamana, a dwarf, to Aditi.
Vamana approached Mahabali who was conducting a yajna. With the completion of this Yajna, King Mahabali will get the authority to overthrow Indra.
King Bali asked Vamana to choose anything that he wanted from his kingdom. Vamana asked for just three steps of land. And the king agreed readily.
Suddenly, the dwarf sized Vamana grew into the skies and with one step covered the earth and with another step the heavens. With no place to keep the third step, Mahabali offered his head, which was pushed by Vamana into the netherworld or pathalam.
But before sending Mahabali to the netherworld, Lord Vishnu gave Bali the boon that he can visit his subjects once in a year. The day Mahabali visits his subjects is celebrated as Onam.
The story in detail can be found in the 8th canto of the Srimad Bhagavatam.