According to a statement in the Matsya Purana, as Lord Shiva fought and killed the demon Andhakasur, a drop of his sweat fell on Earth, and with that sweat, the Vaastu Purusha was created.
The Vaastu Purusha was extremely cruel and brutal by nature and ate everything and everybody on his way. This appalled all the deities in Heaven, and under the leadership of Lord Indra, they imprisoned the Vaastu Purusha in a square pit in the Earth - with his head in the North-east, and feet in the South-west. And that is the posture in which he lies in every single plot of land.
The Vaastu Purusha thereafter worshipped Lord Shiva, seeking a boon. Pleased with him, Lord Shiva blessed him that whosoever constructed a building would worship him first and make offerings to him. In return, the Vaastu Purusha would blessthe occupants and protect them from any ill fortune. Since then, the Vaastu Purusha is called the spirit of the building. To appease him, one must do ceremonies and rituals, and make offerings to satisfy him.
In present life conditions, we must abide by some spiritual rules of life so that we don't harm anyone. The Vaastu Purusha has certain marma or delicate points in his body, which should not be hurt and injured while constructing the building.
According to the scripture Maya Mattam - this should be known to every house owner/architects - the Vaastu Purusha has six bones, a single heart, four vulnerable points and four vessels. If, through the architect's ignorance, any one or more than one part of the body gets "injured", the owner of the structure is, or will be, ruined.
The Vaastu Purushaa, laid on the ground/land, is measured in the form of squares. The measurements start from cardinal directions of East to West and North to South. The Mandala of squares is made in two forms, one is of 64 squares and the other is in 81 squares.