The philosophy of creation of mankind is servitude and worship of the Almighty Creator. The holy Qur'an, the last and final revelation of God to mankind explicitly says in ayah 56 of Surah Zariyaat:
"And I have not created the jinn and the men except that they should serve Me."