If you ask someone about their shoes and why they are wearing these shoes, they would answer to protect us from dirts, from cold, from bad hurting things...
They found a purpose and a reason for their shoes, but they didn't find a purpose for their existence.
They didn't and refused to understand God, so how would they be able to understand the purpose of their existence.
Why did God create man? What's the purpose of our existence?
Perhaps there's a more profound inquiry that should be raised before:
In the Noble Qur'an we are told that the creation of Universe is far more complex and marvelous than man creation:
"The creation of the Heavens and the Earth is indeed greater then the creation of mankind; yet, most of mankind know not." [The Noble Qur'an 40:57].
So the first question must be:
Why did God create???
Creation is one of the attribute of God. God is the Creator.
God being the Creator, so the effect of this attribute is His creation.
I will give a human example to approach the idea:
If you go and ask a great sculptor about his sculptures, then he answered you: "well I don't have any sculpture"!!! You would say: "So what makes you a great sculptor"???
The point is here: The greatness of the sculptor is found in his sculptures. His perfection and his skill of sculpting are marked in his sculptures.
(Just remember that this is just a human example to approach the idea. and remember that humans do not create, they just manipulate).
God creation is the manifest of his attribute "The Creator".
In the creation of human mankind, the grace of God is manifested.
God is Perfection. He doesn't need man. But God is Mercy and Love and by His Generosity and Condescension He created man so he can have eternal life to enjoy the pleasures of the Kingdom God has created as a manifestation of His Attribute "Creator".
This is a gift for mankind.
But God made His Gift to only the pious people. That's why a test must be held to raise the pretext in the hereafter. The test is this life. And the Gift is the Eternal life in Heaven where there is no eye has even seen, things of which no ear has ever heard and what no one has ever imagined.
Most humans refused this gift and started to ask once again:where from? And where to?