The reason why we exist and the universe exists is a Hikmah from Allah (swt).
Our only reason for existence can be summed in up Surah 51:56
"And I did not create the jinn and mankind except to worship Me." (51:56)
There is the answer
I do find it rather odd that a god would think that he has nothing better to do with infinite time than to create a load of slaves to worship him, about 99% of whom end up not worshipping him anyway, despite his creating them for that purpose.
I mean, I imagine it'd get pretty boring to be constantly reassured by your fan-boys of just how great you are, despite the fact that you deserve absolutely no credit for your omniscience and omnipotence anyway because you only possess those attributes by some extremely improbable fluke of metaphysics.