To understand this, you should know the actual meaning of lord Ganesha's story .
The most well-known story about Ganesh’s birth is probably the one
taken from the Shiva Purana
Once mother Parvati wanted to take a bath, there were no attendants
around to guard her and stop anyone from accidentally entering the
cave. Hence she created an image of a boy out of dirt and infused life
into it, and thus a little boy was born. Parvati asked the boy not to
allow anyone to enter the house, and the boy obediently followed his
mother's orders.
Background: There are 2 energies in this Universe. One is the
Universal GOD Energy that is outside us and the other is the Soul
Energy that is inside a person. Hindu scriptures know that GOD is
beyond Man or Women. To explain to a novice GOD is depicted sometimes
as a Man and sometimes a Women (Per Hindu scriptures). So sometimes
the Universal GOD is depicted as Man and sometimes it is depicted as a
Woman. Similarly the soul inside is either a Woman or a Man depending
on what the Universal GOD is depicted as.
Explanation: So in the story of Ganesh’s Birth, Parvati is depicted as
Universal GOD and Shiva is the Soul in the body.
After a while Shiva returned from outside, and as he tried to enter
the house,
Explanation: In a living person, Shiva (Soul) is always trying to
reach Parvati (Universal Soul).
Shiva came to meet Parvati and was stopped by the little boy. He told
the little boy that he was Parvati's husband, and demanded that he be
let in. The little boy would not hear any person's word other than his
dear mother's. So Shiva has a fierce battle with the little boy. The
little boy was strong and rose up to the challenge and fought Shiva
and held him back.
Explanation: The force stopping Soul(Shiva) from reaching Universal GOD (Parvati) is the little child and that is the EGO of the
person. EGO is explained in different ways. Will not go in detail on
what EGO is in this post. Just know that EGO is so strong that it can
stop Shiva(Soul) from reaching Parvati (Universal GOD).
At last Shiva severed the head of the little boy head with his
trishula.
Explanation: The only way for Shivato meet Parvati is to cut the head
of EGO. i.e Bow the head to the Universal GOD. When EGO is out of the
way Shiva(Soul) and Parvati
(Universal GOD) meet in a living person.
When Parvati came out and saw her son's lifeless body she asked that
Shiva restore the boy’s life. A Brahma suggested that Shiva replace
the boys head with the first living being that came his way which lay
with its head facing north. Shiva then sent his celestial armies
(Gana) to find and take the head of whatever creature they happened to
find asleep with its head facing north. They found a dying elephant
which slept in this manner, and after its death took its head,
attaching the elephant's head to the boy’s body and bringing him back
to life. And thus Ganesha is Born.
Explanation: In a living person the EGO is gone and therefore the Soul(Shiva) of the person has met the Universal GOD(Parvati). The
energies activated in the person now is that of Ganesha. Meaning that
any action taken by a person while connecting the Soul to the
Universal GOD will remove obstacle. The elephant head is depicts the
removal of obstacles.
Ganesha is married to 2 sisters Riddhi and Siddhi.
Explanation: In that state Ganesha i.e. Shiva(Soul) and Parvati (Universal Soul) meeting in a living person, interacts with the world.
In this world one can only give or/and take from someone. i.e. Ridhi
and Sidhi. So Ganesha (living person) is married to the world of
giving and receiving. The living person is married to either taking or
giving something to this world.
Ganesha has 2 children from Riddhi and Siddhi..Name of the children
are Shubh and Labh
Explanation: So a living person in the state of Ganesha interacts with the world Riddhi and Siddhi there is an output from it that
interaction i.e. He gets SHUBH LABH or PURE PROFIT.
Shubh and Labh ask their parents for a sister and they get a sister
names Santosh.
Explanation: So from the interaction with the world as Ganesha a person gets SHUBH LABH (PURE PROFIT) and from the PURE PROFIT he gets
SANTOSH or CONTENTMENT.
That is the purpose of Life. To get CONTENTMENT in every action that
one takes in Life.
Summary:
In a living person the Soul (Shiva) is always trying to meet the
Universal GOD (Parvati).
EGO stops the Shiva (Soul) from meeting Parvati (Universal GOD).
When the head of EGO is removed Shiva(Soul) and Parvati (Universal
GOD) meet thereby creating igniting the energies of Lord Ganesha.
As Ganesha when a person interacts with the world as, giving (Riddhi)
and taking (Siddhi), then the output is Shubh (Pure) Labh (Profit).
From Shubh Labh (Pure Profit) the person gets Santosh (Contentment).
Conclusion
When one prays to Lord Ganesha then one is asking to connect to the
Universal Soul to remove obstacles and to give us contentment. All the
rituals are fully aligned to this principle.