According to the legend, Kerala witnessed its golden era during the reign of King Mahabali. Everybody in the state was happy and prosperous and the king was highly regarded by his subjects. He was that much highly regarded among the subjects. Presuming that he might become over-powerful, the Gods under Indra approached Mahavishnu claiming that Mahabali is now equivalent to an Indra.
Mahavishnu transformed himself into a dwarf called Vamana and approached Mahabali while he was performing a yajna and asked for alms. Pleased with the dwarf Brahmin’s wisdom, Mahabali granted him a wish. The Vamana asked for a simple gift - three paces of land - and the king agreed to it. Vishnu in the guise of Vamana then increased his stature and with the first step covered the sky, blotting out the stars, and with the second, straddled the netherworld. Realizing that Vamana's third step will destroy the earth; Mahabali offered his head as the last step.
Vishnu's fatal third step pushed him to the netherworld, but before banishing him to the underworld Vishnu granted him a boon. Since he was attached to his kingdom and his people, he was allowed to return once a year from exile. Onam is the celebration that marks the homecoming of King Mahabali. It is the day when a grateful Kerala pays a glorious tribute to the memory of this benign king who gave his all for his subjects.It is this visit of Mahabali that is celebrated as Onam every year. People including children celebrate the festival in a grand way and impress upon their dear King that they are happy and wish him well.