Bali the grandson of Prahlada, had conquered all the gods with his heroic deeds. As Indra was the king of the gods, so Mahabali was the king of the demons.
But Bali was a devotee of Vishnu. He conquered the earth and defeating Indra, he ruled heaven for several years, driving out the deities from their abode. Devmata Aditi pained by her son’s grief did penance, entreating Vishnu to restore Indra’s rule over heaven. Lord Vishnu pleased with her dedicated devotion was born to Aditi and Kashyapa as Vamana.
The twelfth of the Adityas, Vamana is known to be the younger brother of Indra.Vishnu took the form of Vamana, in the guise of a short Brahman carrying a wooden umbrella. He visited Bali during a sacrifice where the latter was arrogantly distributing gifts of the seeker's choice, to show his powerful wealth. Vamana merely asked for three feet of land measured by his small feet to live in. Pleased with the dwarf Brahman’s wisdom King Bali granted him the wish; against the warning given by his Guru Sukracharya who very well know it was Vishnu in the guise of a Brahman.
All of a sudden Vamana assumed the massive form of Mahavishnu, dominating the universe. With his first pace he covered the earth, with the second the heavens and when there was no room for the third step, Bali offered his head to fulfill his word. Consequently Vamana placed his third step on King Bali's head and gave him immortality for his benevolence.
Pleased with Bali’s devotion, Vishnu did not destroy him, but gave him the kingdom of the underworld in recognition of his generosity. With this incidence King Bali was defeated and the deities regained their freedom.
Vamana, Vishnu Incarnate, taught King Bali that arrogance should be discarded to progress in life, and wealth never be taken for granted since it can easily be snatched away. He was pleased by King Bali's determination to keep his promise in spite of his spiritual master's curse and the prospect of losing all his riches. Vishnu named the King Mahabali because he was a great soul. He was the grandson of Prahlada and the son of Virochana who was killed in a battle with the Devas.
Mahabali was deeply attached to his kingdom and loved by his subjects. Thus he was allowed by the gods to return once a year. Bali is supposed to return every year to the land of his people, to ensure that they are prosperous. This is celebrated as the Onam festival in Kerala, where he is also called Maveli (a contraction of Mahabali - the Great Bali).