Everything is mentioned in the sacred texts in an encoded language and only those who really and sicerely try to understand could understand this. The symbolism in the fact that Lord Shiva beheaded Ganesha's head - is that He,The Lord-Destroyer, destroyed Ganesh's ignorance. Ganesha was ignorant because He did not realise His own Father. And Lord Shiva gave Him a Rebirth after giving Him the Head of an Elephant. Elephant is symbolic of Intelligence. ANd so Lord Shiva infact gave Him (Ganesha) the Intelligence (Budhdhi) to realize ephemeral from mortal and so on. Its all encoded.