For the sake of the argument I make the assumption that the Jewish god Jahwe or gods from other religions like Brahma, Vishnu or Shiva actually exist and that one of them created the world.
Why did the god create the world? In a religious context I often find the answer
The god created the world to show his/her glory.
If that’s the main reason then I cannot consider such an action a proof of divine greatness. A human person with a similar motivation would be diagnosed: Addicted to admiration due to an ego weakness.
Does the title question have an answer which is philosophically more convincing and satisfying?