it is because of lord shiva's boon to elephant demon GAJASURA...
read the story below...
The demon Gajasura (also knows as Nila ) was a friend of Andhaka's. Nila took the form of an elephant and attacked Shiva, but
was killed by one of Shiva's attendants. Two representations of Shiva
from this battle, often combined, are Shiva Andhakasuravadha (impaling
Andhaka) and Shiva Gajasamharara (dancing on Nila's decapitated head
or underneath his butchered skin).
Gajaharamurti is said to have been sent by sages of Darukavana to kill Siva for seducing their wives as Bhikshatana. Siva killed the
elephant and opened his head.
Another story of Gajasura explains that the rakshasa called Gajasura was an ardent devotee of Lord Siva who underwent penance for
many years to receive special boons. Siva, who is easily pleased by
prayers, was moved by Gajasura's devotion, and offered a boon.
Gajasura asked Siva to reside in his belly, and Siva agreed.
Meanwhile on Mount Kailash, Parvati was anxious to know the whereabouts of her husband and finally approached Lord Vishnu for
help. Vishnu disguised himself in the form of a street player along
with Nandi, Siva's bull carrier, and the two set out in search of
Shanker (Siva). In Gajasura's kingdom, Nandi performed a dance to
please the demon. In thanks, Gajasura let Siva out of his stomach, but
prayed that he would be allowed to be immortal in the memories of
people. To fulfill this wish, Lord Siva severed Gajasura's head and
freed him from the cycle of birth and death. He carries the head along
On Mount Kailash, Parvati comes to know of Vishnu's victory and is very happy. She creates a doll out of the dough that she uses
in her bath, and calls him Vinayak - the one who puts off all
obstacles. This boy having never seen Siva, prevents his entry into
the palace. In a fit of fury Shiva beheads the boy and enters the
palace. Parvati is unaware of the happenings and receives Siva with
warmth, for he had returned after a long period. During the course of
their conversation, Siva mentions the incident at the palace gates and
tells her about severing the child's head. Parvati is shocked to hear
the news and pleads with Siva to bring the child back to life for he
is like a son to her.
Shiva who had with him the head of Gajasura, immediately puts it on the torso of the dead child, thus bringing him back to life and
blessing him with a boon that the entire world would worship him in
remembrance of that day.
The trideva always tried not to play with the rules which they embodied in the system. They always had a strict notion, to follow the rules. The best example being, whenever any one of them was angry or not happy with how the rules are making things happen and wanted a sudden change, the other two would console the one to not to do the same, as the universe is a string with bodies connected, a small string moved will change how the universe behaves.
Believe me, there is no magic, people ask such things as that is a simple thing to do and in a jiffy it can be done, however powerful you are you cannot restrain the laws created by the trinity, neither the trinity themselves. Everything in every book, we see even the trinity is helpless in many cases, because they always need to find a way to fight the problem where their own laws are not hindered.
Why wasn't Lord Shiva who is so powerful god able to put back the original head of Ganesha? Why was he so helpless?
Coming to Lord Ganesha, there are many rare points which people don't know.
Ganesha's head was completely destroyed, it wasn't only detached but completely destroyed, no skin left; all burnt to ashes.
There was an elephant which prayed to Lord Shiva and wanted to be his son, the same elephant gave his head to Lord Shiva, which was put on Ganesha's body.
Ganesha being only the part of Prakruti (as Ganesha was solely born from Parvati) was not perfect and needed a Purusha part also, by attaching the elephant's head, Lord Shiva completed Ganesha with the Purusha part too.
Why couldn't Parvati create another Ganesha like how she had created earlier?
It's not about new creations, she's a mother, and she had to have a mother's feeling in her. Ganesha being Parvati's son, when he died, it implanted a huge amount of pain and anger in Parvati's heart, this pain cannot be undone, it's a binding of a mother to the child, a universal law, which cannot be ruled out or bluffed. Every mother can give birth to a new child that doesn't mean she should stop lamenting on her dead child, a dead child is like loosing a part of your soul and it can be understood only by a mother, men are feeble creatures in that. Afterwards, Parvati did have another child.
Note : I cannot provide scripture references as I don't remember much. Secondly, my knowledge is limited to things I listened from Gurus and a general logical understanding.
Like any library, Hinduism Stack Exchange shares great information, but does not offer personalized advice, and does not take the place of seeking such advice from any Acharya, Pundit, astrologer, Guru or other trustworthy Counselor.