This myth appeared in the Purana literature - Shivapurana (Shatarudra and Vidyavara samhita), Karmapurana, Brahmanapurana, Skandapurana. The outline is same: Brahma and Vishnu were disputing with each other for the status of supreme God. Just then an immense pillar of flame manifested itself in their midst, within which was recognized the towering figure of the three-eyed Shiva as the Ultimate Truth. But the fifth head of Brahma taunted him. Then, Shiva created a blazing Bhairava, addressing this Kalabhairava as "Lord of Time-Death" (Kaala): "You are called Bhairava because you are of terrifying features and are capable of supporting the universe. You are called Kaala-Bhairava, for even Time-Death is terrified of you." In a trice, Bhairava ripped off Brahma's guilty head with the nail of his left thumb. The severed head immediately stuck to Bhairava's hand, where it remained in the form of the skull, destined to serve as his insatiable begging-bowl. Shiva directed Bhairava to roam the world to atone for the sin of Brahmanicide, the worst of crimes in dharmashastras. On arriving at Kashi, Brahmahatya sank into the nether-world, and the holy ground on which the skull fell, freeing Bhairava from his Brahmanicide, came to be known as Kapalamocana. It was on the eighth day (ashtami) in the dark half of the month of Margashirsha that Lord Shiva manifested himself as Bhairava.
It is a myth in brief. Certainly, set of interpretations are possible here. But what is the problem with this fifth head? It is very interesting. Actually, this head is opposed to Brahma's "normal four". This head proposed incest to his daughter, who indignantly cursed him to always speak contrarily or bray like a donkey, whereupon the fifth head always spoke evilly and coarsely. In brief, this unfortunate head showed all possible infringements - sexual, linguistic, animal, moral, alimentary and aesthetic.
Brahma's name (Brahmā) should not be confused with Brahman, who is the supreme God force present within all things. Brahma's job was creation of the world and all creatures. Brahma's role as the creator is over. It is left to Vishnu to preserve the world and Shiva to continue its path of cosmic reincarnation. Brahma is not raised to the supreme level of cosmogony. Can be here the reason of his decapitation? His fifth head negated all that which Shiva's fifth head had symbolized, which is the symbol of Supreme Brahman. And the fifth head can belong only to One.
So, Brahma is punished with decapitation, Shiva is forced to make Bhairava wander to Kashi for absolution, and even the gods are repentant after Shiva exposes himself as a fire-linga to them. Even throughout the inauspiciousness, the myth preserves the dharma inherent in the universe. Through this pursuit of forgiveness, Bhairava becomes sanctified and receives the name of Sin-Eate. His crime was conditional, symbolical and necessary. In Kashi, the pure Vishvanatha meets the "impure" Bhairava. They unite in the God, withdrawn into himself, the God of ultimate salvation. The Absolute Reality of Brahman.
OM BHAIRAVYAI NAMAH
OM NAMAH SHIVAYA