Long long ago Lord Shiva fought against the demon named ANDHAKA and killed him. While fighting with demon, Shiva was very much tired and began to sweat profusely. A man was born of the drops of Shiva's sweat. He looked very cruel. He was very hungry. So he began to make penance to appease Lord Shiva and get a boon from him. Shiva was pleased with his penance and appeared before him.The devotee prayed to Shiva,"Oh Lord! Please permit me to eat away all the three worlds." Shiva said," Let it be so." The devotee's joy knew no bounds. He got possession on all the three worlds and first he was ready to eat the terrestrial world (Bhooloka). Then the celestial (Devatas), Brahma, Shiva and the demons (Rakshasas) also were terrified and caught hold of the devotee encircling him.
Vaastu Purusha, being arrested like this, said to the Gods, "Oh, Celestial Beings! You have all caught holdof me and tied me on all the sides. How long shall I be like this, in this position hanging my head down like a prisoner? What shall I eat? Listening to those words, the celestial beings said, "Today is Bhadrapada Shukla Triteya Saturday and 'Visakha Star'; So you lie down here on the ground changing your position once in three months, i.e. from 'Bhadraspada' to 'kartik' you lie down putting your head in the eastern direction and your feet towards the west. During the months of "Margashira", 'Pusham' and 'Magha', you lie down towards the south looking towards the west and put your feet towards the north during the months of 'Phalgun', 'Chaitra' and 'Vaisakh' put your head towards the west and feet towards the east., looking towards the north; in the months of 'Jyestha', 'Ashadha' and 'Sravana', put your head towards the east. North and the feet towards the south & look towards the east. Whatever side you may turn, you will have to lie down on the left side only. You will be known as 'VAASTU PURUSHA'. You will tease the people, to your heart's content, who construct buildings and temples, dig wells and tanks on the side towards which you see and in the direction towards which you hold your feet. You may trouble and even devour those people who construct the aforesaid buildings and temples etc. In the direction where you lay your head and back and those who lay foundation-stone without worshipping you or without satisfying you with "Homa" and the like. Then the Vaastu-Purusha was quite satisfied. Since then the worship of Vaastu-Purusha has been in vogue and it has become compulsory for those who want to construct any kind of building.