There was a demon named Vali who was descended from Hiranyakashipu. Extemely strong, he defeated the gods and drove them out of heaven. The mother of all the gods was Aditi and Aditi was despondent that her sons should suffer so at the hands of demons. She therefore began to pray to Vishnu so that she might have a powerful son who would provide a fitting reply tot he demons, particularily to Vali. For a thousand years, Aditi meditated. Vishnu was pleased at these prayers and appeared before Aditi. ―What boon do you wish for?‖ he asked. ―The demons are oppressing my children,‖ replied Aditi. ―Please grant me a son who will defeat the demons.‖ ―Do not despair,‖ said Vishnu. ―I myself will be born as your son. I will take care of the demons.‖ You will remember that Aditi‘s husband was the sage Kashyapa. Kashyapa and Aditi accordingly had a son. This son was a dwarf (vamana).
Vali happened to organize a yajna and the dwarf came to attend the ceremony. On the occasion of the yajna. Vali had decided that he would not refuse anyone what he asked for. Shukracharya was the preceptor of the demons and naturally, he was Vali‘ guru as well. Shukracharya saw through the trickery that was involved and realized that the dwarf was none other than Vishnu. He tried to put Vali on his guard and warned Vali that he should not grant what the dwarf asked for.
But Vali would not listen. ―Vishnu is the lord of everything.‖ He said. ―I am indeed fortunate if Vishnu has come to grace my ceremony in the disguise of a dwarf. How can I refuse what he asks for?‖ Vali welcomed the dwarf with offerings. ―What is your desire?‖ he asked. ―I am duty bound to give you what you ask for.‖ ―I desire nothing much,‖ replied the dwarf. ―I do not want gold or riches or elephants or horses. All that I ask for is as much of land as can be covered in three of my footsteps.‖ ―Granted,‖ said Vali.
No sooner were the words uttered that he dwarf assumed a gigantic form. His head rose way up into the sky. With each one of his footsteps, Vishnu covered one of the three worlds. Thus Vali ended up by donating all of the three worlds to Vishnu and there was nowhere for the demons to live in. But Vishnu was pleased at Vali‘s generosity. He therefore decreed that, henceforth, the demons would live in the underworld. As for heaven, it was returned to Indra. This was the story of Vishnu‘s dwarf incarnation.