As Lord Shiva is himself one of the Trimurti, he must be a त्रिकालज्ञ (trikālajña) i.e., knower of past, present and future.
If he's a trikālajña, why didn't he know that he was going to behead his own son, Vināyaka (Ganesha)?
Hinduism Stack Exchange is a question and answer site for followers of the Hindu religion and those interested in learning more about Hinduism. It only takes a minute to sign up.Sign up to join this community
This whole event is a series of interconnected Chain events. I'm here summarizing the chain events:
Gajasura was a devotee of Lord Shiva and he got a boon that his head would be revered in future as described in the answer here.
Lord Shiva once killed Surya and Kasyapa (father of Surya) cursed him as described in answer here.
He struck Surya with a trident and this made the entire world plunge into darkness. Surya was the sage Kashyapa's son and so, for this act, Kashyapa cursed Shiva. "Just as you pierced my son's chest with a trident, your son's head will be chopped off one day," said Kashyapa.
Ganesha (Vinayaka) was only son of Prakriti tatwa as made only by Parvati. Lord Shiva transformed Purush tatwa to Vinayaka from his Trishula while beheading him. And thus he philosophically became son of both Shiva and Shakti.
Ganesha was formed from dirt/mud by Parvati. So his intellect had also became dirt formed intellect. As a result he couldn't recognise the Supreme Shiva and other Gods, Sages also. So, Beheading the head removed the dirt formed intellect and it also removed only Maya/Prakirti/Parvati formed intellect.
These all events described above are interconnected as Chain events. So, Beheading Vinayaka (Ganesha) by Lord Shiva was necessary.
I would like to quote the following text hope this helps
The story goes that Parvati created a boy out of dirt from her body and appointed him to guard the doorstep. The first question that comes is how could Parvati, the Goddess Herself, have so much dirt? Parvati symbolizes the triguna sattva, rajas and tamas. The entire creation is made up of trigunas. The dosha or imperfections that originate out of the triguna is an obstruction for the functioning of Prakriti. That was the boy that Parvati created to stand guard at the door.Shiva is Shuddha Chaitanya, pure consciousness. Like the sun does not recognize darkness and cuts through it, Shiva does not recognize dosha and slays the impurity. But Prakriti cannot stay without impurity. So Shiva replaces the dosha with the head of an elephant, which symbolizes knowledge. Through knowledge, all the doshas or obstructions of Prakriti can be taken care of. This is the spiritual and metaphysical meaning of Ganpati being slain. So worshipping Ganpati as the remover of obstacles and the giver of gyana, knowledge is the most amazing depiction of the nature of consciousness.
For more info refer here
Because lord Ganesha was created with mud his buddhi(intellect) was dushit(contaminated) he didn't respected other gods & rishis who came and tried to tell him the truth that Lord Shiva was his father. So that's the reason Shiva cut his head and replaced it with the one of an elephant which is a symbol of knowledge. The elephant whose head was cut and replaced with that of Lord Ganesha his name of Gajasura. You can search about him.
It was all a leela between Parvati,Siva and Vishnu in order to give Ganesa a primary place in worship, because as created, he was said to be of Tamasika nature:
- O Nārada, on hearing your words, the great lord who grants benediction to his devotees became desirous of fighting with the boy.
- He called Viṣṇu and consulted him. Then with a great army and the gods, He, the three-eyed lord, stood face to face with him.
- After remembering the lotuslike feet of Śiva, the gods possessing great strength, kindly glanced at by Śiva and highly jubilant, fought with him.
- Viṣṇu of great strength, valour and skill and possessing great divine weapons and Śivā’s form fought with him.
- Gaṇeśa hit all the chief gods with his staff. He hit Viṣṇu too, all of a sudden. The hero had been conferred great strength by the Śaktis.
- O sage, all the gods including Viṣṇu were hit by him with the stick. They were turned back with their strength sapped.
- O sage, after fighting for a long time along with the army and seeing him terrific, even Śiva was greatly surprised.
- Thinking within himself “He has to be killed only by deception and not otherwise” he stayed in the midst of the army.
9-10. When lord Śiva who though devoid of attributes had assumed the attributive form was seen in the battle, when Viṣṇu too had come thither, the gods and Gaṇas of Śiva were highly delighted. They joined together and became jubilant.
- Then Gaṇeśa the heroic son of Śakti following the course of heroes, at first worshipped (i.e struck) Viṣṇu with his staff, Viṣṇu who confers happiness to all.
12-13. “I shall cause him delusion. Then let him be killed by you, O lord. Without deception he cannot be killed. He is of Tāmasika nature and inaccessible.” Thinking thus and consulting Śiva, Viṣṇu secured Śiva’s permission and was engaged in the activities of delusion.
Vishnu had a strong role in the actual killing of Ganesa:
25-27. On seeing Gaṇeśa, Viṣṇu said—“He is blessed. He is a great hero of great strength. He is valorous and fond of battle. Many gods, Danavas, Daityas, Yakṣas, Gandharvas, and Rakṣasas I have seen. In the entire extent of the three worlds, none of them can equal Gaṇeśa in regard to brilliance, form, features, valour and other qualities.”
- Gaṇeśa, son of the Śaktis whirled the iron club and hurled it at Viṣṇu even as he was saying so.
- After remembering the lotus-like feet of Śiva, Viṣṇu took up his discus and split the iron club by means of discus.
- Gaṇeśa hurled the piece of iron club at Viṣṇu which was caught by the bird Garuḍa and rendered futile.
- Thus for a long time the two heroes Viṣṇu and Gaṇeśa fought with each other.
- Again the foremost among heroes, the son of Pārvatī took up his staff of unrivalled power remembering Śiva and struck Viṣṇu with it.
- Struck with that unbearable blow he fell on the ground. But he got up, quickly and fought with Pārvatī’s son.
- Securing this opportunity, the Trident-bearing deity came there and cut off his head with his trident.
The Gods were worried Parvati might destroy creation and prayed to her:
- O Mother of the universe, obeisance to you. Obeisance to you, O Śivā. Obeisance to you. O Caṇḍikā. Obeisance to you, Kalyāṇī.
- O mother, you alone are the primordial Śakti. You are the eternal cause of creation. You alone are the sustaining power. You alone are the cause of dissolution.
- O goddess, be pleased. Spread peace. Obeisance be to you. O goddess, the three worlds are agitated by your fury.
Brahmā said:— 35. The great goddess Pārvatī thus eulogised by you and other sages glanced at them furiously. She did not say anything.
- Then the sages bowed at her lotus like feet and spoke to her in low voice with devotion joining their palms in reverence.
The sages said:— 37. O goddess, forgive, forgive. The final dissolution seems near at hand. Your lord is standing here. O mother, you see him.
- What are we, the gods, Viṣṇu, Brahmā and others? We are only your subjects. We stand here with palms joined in reverence.
- O great goddess, our guilts shall be forgiven. We are agitated and distressed. O Pārvatī give us peace.
Brahmā said:— 40. After saying this, the agitated and distressed sages stood in front of her with palms joined in reverence.
- On hearing their words Pārvatī was pleased and she replied to the sages with her mind full of compassion.
The goddess said:— 42-43. If my son regains life there may not be further annihilation. If you can arrange for him an honourable status and position among you as the chief presiding officer, there may be peace in the world. Otherwise you will never be happy.
Siva often kills temporarily (like Daksha) and this was all a leela to remove tamas from Ganesa and make him worthy of worship.
Parvati tells the purified Ganesa
You are blessed and contented now. You will receive worship before all the gods. You will be free from distress.
Another example of a play-fight is Siva fighting Arjuna in the Kiratarjuneeyam fight only to purify Arjuna's body:
Mahabharata Critical Edition page 1195:
Tryambaka touched the immensely energetic Phalguna and everything that was impure in his body, was immediately destroyed.
This is a serious problem only if one takes this particular Puranic story seriously. There are several Puranic stories about Lord Ganesha and his elephant head. These stories are:
STORY 1. Once Parvati, just for fun, prepared an image of a child with an elephant's head, out of the unguents smeared over her body and threw it into the river Ganga. It came to life. Both Ganga and Parvati addressed the boy as their child. Hence Lord Ganesha is known as Dvaimatura, 'one who has two mothers';
STORY 2. Parvati prepared the image of a child out of the scurf from her body, endowed him with life and ordered him to stand guard before her house. When Siva wanted to enter the house he was rudely prevented by Ganesha. Siva became Rudra and got him beheaded. Seeing that Parvati was inconsolable, Siva grafted an elephant's head on the body of the boy and gave him life. Siva appointed this new-found son as the head of all his retinues, who thus became 'Ganapati'.
STORY 3. He sprang from Siva's countenance which represents akashtattva (principle of ether). His captivating splendour made Parvati react angrily and curse him, resulting in the elephant head; and
STORY 4. Ganesha was originally Krishna himself in the human form. When Sani, the malevolent planet spirit gazed at him, his head got separated and flew to Goloka. The head of an elephant was subsequently grafted on the body of the child.
[Hindu Gods and Goddesses by Swami Harshananda]
Which one of these stories is true? All four can't be true. The simplest position to take is that none is true. The common people many centuries ago did not understand the philosophical import and wanted some simple explanation of Ganesha's elephant head. The Puranic stories were written by various authors to give concrete and simple explanations to those people. These are tales of imagination and not to be taken literally.
Tales of Imagination
Brahma tells Narada "This brief account of the manifestation of the Lord is what is called the Bhagavata. The Supreme Being Himself gave the knowledge of it to me. I have also given to you a brief account of the Lord's glories and attributes. You elucidate it with the help of your imaginative power in a way that will generate devotion in the mind of men for Sri Hari who is the soul and support of all."
Bhagavata Purana II.8.51-52
ANSWER: The answer to this question is that the incident didn't happen since Shiva didn't actually behead Ganesha. So there is no reason to doubt Shiva's omniscience.
Unnecessary complication has been introduced by claiming without any proof that these 4 stories are depicting events in 4 different kalpas. This proposal immediately raises several questions. Why should any author talk about events in previous kalpas when he is writing the text for the elucidation of people living in his kalpa? I am leaving aside the question as to how the author knew about any event in a previous Kalpa separated by billions or even trillions of years. What good is such a story about a previous kalpa doing for people living in the current kalpa? How does one know which story belongs to which kalpa? Is there any exact reference that says that these stories belong to different kalpas?
Puranas were written for the elite by the elite. They answered questions that the educated of that time were asking. The simplest interpretation of these 4 stories is that the gents who wrote these stories did not know how to explain the elephant head iconography of Ganesa and came up with four wild inventions. Kalpa had nothing to do with these stories. If anyone wants to link these 4 stories with different kalpas then they better come up with an exact reference that explicitly links these stories with different kalpas.
Spiritual interpretation of the beheading
Professor John Grimes gives an interesting spiritual interpretation of the beheading.
Ganesa was to guard his mother's door. He is known as the gatekeeper as well as the lord of beginnings. His beheading took place at a threshold as all beginnings do. Every beginning is the end of the old and the beginning of the new. In order to transcend the beginning and ascend to the Divine, one must "lose one's head", that is, give up one's egotistical viewpoint. One must be both a victor and a victim. One is a victim because one's head must be lost. One is a victor because the new is a new beginning, a divine manifestation.
Ganapati Song of the Self, Chapter 4, Fingers pointing at the moon, by John Grimes
The Devi Bhagvatam Purana paints a general picture and understanding of why these events happen. It happened because of the Daivika-Vidhana (दैविक-विधान). Everything is pre-ordained and pre-determined as a part of the eternal kaal-chakra.
Although, the beheading of Ganesha is not mentioned, we may generalize the following excerpt to all these similar events.
After god Vishnu was apparently beheaded with string of Saranga bow, all gods started lamenting. And devaguru Brihaspati and Brahmâ explain the importance of Daiva (दैव).
Chapter 5, Book 1, DeviBhagvatam
At this juncture, seeing Śiva and the other Devas crying, Brihaspati, supremely versed in the Vedas, consoled them thus :-- “O highly fortunate one! what use there will be in thus crying and repenting? it ought you now to consider the means that you should adopt to redress your calamities. O Lord of the Devas! Fate and one’s own exertion and intelligence are equal; if the success comes not through Fate (Luck or chance) one is certainly to show one’s prowess and merit”.
42-46. Indra said :-- Fie to your exertion when, before our eyes, the head of Bhagavān Viṣṇu Himself has been carried off! Fie, Fie to your prowess and intelligence! Fate is in my opinion, the supreme.
Brahmā said :-- Whatever, auspicious or inauspicious, is ordained Daiva (Fate), every one must bear that; no one can go beyond the Daiva. When one has taken up a body, one must experience pleasure and pain; there is no manner of doubt in this. See, in long-past days, by the irony of Fate, Śambhu severed my head; His generative organ, too, dropped down through curse. Similarly Hari’s head has, to-day, fallen into the salt ocean. By the influence of time, Indra, the Lord of Sachi, had thousand genital marks over his body, was expelled from Heaven and had to live in the Mānas sarovar in the lotuses and had to suffer many other miseries.
47-50. O Glorious ones! When such personages have suffered pains, then who else is there in the world, that dues not suffer! so you all cease sorrows and meditate on the Eternal Mahāmāyā; who is the Mother of all, who is supporter of all, who is of the nature of Brahmāvidyā (the Supreme Knowledge) and who is beyond the Gunas, who is the Prime Prākriti, and who pervades the three Lokas, the whole universe, moving and unmoving; She will dispense our welfare.
English Translation by Swami Vijñanananda
Thus, as per the Devi Bhagvatam, all these similar events (like beheading, curses, boons, wars, etc.) involving Tridevas and other gods like Ganesha, Indra, etc., it all happen due to the great delusion of the Supreme Parashakti, Mahāmāyā, who's the prime mover of the fate and destiny of anyone who has taken up a body, whether divine or non-divine.
Thus, basis the above excerpt from the Devi Bhagvatam Purana, we can say, that despite being a trikālajña, god Shiva beheaded his son, due to the great delusion of the Supreme Goddess Mahāmāyā, under whose control every mobile and immobile being and thing is said to be.
Other explanation maybe that it was all a great-leela (लीला) of everyone involved in the incident.