According to Vaishnava mythology, Mahabali defeated the gods and took over all three worlds. This made the gods unhappy and they sought the help of Lord Vishnu against Mahabali. Vishnu said he would aid them but did not want to be involved in a battle with Mahabli (since Mahabali worshipped Vishnu). So, he transformed into a poor dwarf Brahmin and went to Mahabali, asking for three wishes. He asked Mahabali for the property right over a piece of land which measured ‘three paces’.
He then grew in size and in only two steps covered whatever Mahabali had. Mahabali then offered his head for the third step, which Vishnu stepped on, throwing him into the nether world. However, Vishnu was impressed by Mahabali’s devotion and told him that he could return to earth once a year – and this yearly visit is what is celebrated as Onam.