Onam is the day on which Lord Vishnu was born as Vamana on earth.
This festival comes on Dwadasi (12th Day) of the month Bhadrapada.
Some details about Vamana avatara as per Bhagavatam:
Emperor Bali was the grandson of Prahlada. Prahlada’s son was Virochana whose son was Bali.
Lord Vishnu took one avatara (Narasimha avatara) to protect his devotee Prahlada from his own father Hiranyakasapa. He took one more avatara to curb Bali from occupying the kingdom of Devas.
Once guru Sukracharya, on behalf of Bali performed ‘Viswajit’ yaaga, as a result of which Bali got a powerful Bow and an arrow holder which can create arrows on its own and keep itself full always. He also got a golden chariot and sacred jacket that can protect him from any arrow. With all these powers, Bali attacked Indralok and took control of all properties of gods.
Deeply pained by the plights of devatas, their mother Aditi requested her husband Kasyapa to suggest a way out. Based on his suggestion, she performed a vrat called payovrat which essentially is a way of praying lord Vishnu. As a result, lord Vishnu appeared her and promised that he would become her son and do the needed favor to Devas.
Thus, lord Vishnu was born to Atidi on Dwadasi of month of Bhadrapada in the form of Vamana. In this incarnation lord became brother of Indra hence he is also called ‘Upendra’.
Immediately, the kid took the form of a little brahmin boy of age 7. Bruhaspati performed the necessary rituals like Upanayanam. After which the boy went to the place where Bali was performing Aswametha Yaga. Bali could clearly see the diving glow of the boy and welcomed him. As per the customs of the Yaga, Bali offered a boon to the boy who asked for three paces of land.
Vamana then revealed his identity and enlarged to gigantic proportions to stride over the three worlds. He stepped from heaven to earth with the first step, from earth to the netherworld with the second. King Mahabali, unable to fulfill his promise, offered his head for the third.
Vamana then placed his foot and gave the king immortality for his humility. He was also allowed to return every year to see the citizens of his country. People of Kerala celebrate Onam every year welcoming the return of Mahabali.
For the sacrifice that Bali has offered, he got equally many boons from the Lord.
Bali is one of the chiranjeevis, who lives till the end of Kalpam (or who has no death).
Bali is made the king of sutala loka and Lord himself in the form of a demon protects that loka as a gate keeper.
For the next coming manvantara (surya saavarni manvantara), Bali will be made Indra.