There are several different versions of the birth of Brahma and creation in Hindu mythology. In one version Brahma was born from a lotus that was blossoming from Vishnu's navel. In another, the self existant Lord came into being to dispell darkness in the universe. He created the waters and placed a seed in them. The seed became a golden egg from which Brahma was born. He split the egg into two parts to create the heaven and the earth. He then had ten mind born sons who finished the work of creation.
In another version he separated himself into two parts, male and female, and had a child called Viraja. From Viraja came Manu. Manu in turn was the procreator of mankind.
And in the most colorful version he was alone and complete within himself. He was the only thing in exisitance. Over time he became lonely and created a consort out of his own flesh. Her name was Shatarupa, and she had the ability to change her form. Brahma became fasinated with her and wanted to posses her.
He chased Shatarupa, and of course she fled from him. It is unclear where they were running at this time, since they were supposed to be the only things in existance. Each time Brahma caught Shatarupa she would change her form. Brahma would take the male version of that form and couple with her. In this way all of the creatures in the world came into being.
In order to keep an eye on his consort, Brahma sprouted five heads. He spent all of his time watching and chasing after the devine consort. Shiva, in an attempt to help Brahma regain control, tore off one of Brahma's heads. This caused Brahma to temprarily come to his senses and he took Saraswati as his new consort. With her help, he regained control over his mind.

