Why do we have to worship God ?
Of course, it is natural to be thankful for everything He did for us. But fact is that we did not choose to come into being, so why are we threatened with hell if we do not pray for exemple ? Why did Allah destroyed so many cities which refused devotion ?

In short, what is the philosophy being the obligation of worship?

Worshipping God is for our own good. We benefit when we worship God. Even if we did not choose to be here, our intellect tells us to protect ourselves and remove any harm that may come our way. When we worship we are protecting self in this life and in the afterlife. We are putting our soul in a state of comfort by fulfilling our duties to our Creator.