Although there are many a narrative that traces the history of the festival, the most popular one goes like this. Onam is celebrated to welcome Mahabali, Malayalis’ favorite king who apparently once ruled the place. As per the Hindu mythology, Mahabali, the demon king, was the great great grandson of Kashyapa, great grandson of Hiranyakashipu, grandson of one of the biggest devotees of Vishnu, Prahlada.
Mahabali, a truly righteous king, conquered all the three worlds by overpowering devas or the gods. Shook, devas appealed to Lord Vishnu to defeat Mahabali. Vishnu did not comply with the request as Mahabali was a Vishnu devotee. However, he decides to test the devotion of Mahabali. Disguised as a young brahmin lad named Vamana, Vishnu approaches Mahabali, who was celebrating his victory by performing a yaga. The king asks the boy the purpose of his visit and agrees to offer anything he wants. Vamana asks for a piece of land that measures three paces. The king concurs. However, Vamana assumes a gigantic size and completes the three worlds in two paces, asking for the third one. The king offers his own head for Vamana to step, upon which Vamana stamps and sent him to netherworld. However, impressed by Mahabali’s faithfulness, Vishnu grants him a boon; that he can visit his beloved subjects and kingdom once in a year.
Every year, Malayalis thus started celebrating the occasion of the visit of their loved king as Onam.