Genesis 1:1, In the beginning, God created the heavens and the earth.
Why did God create? God creating ex nihilo (out of nothing) is His modus operandi. There was no internal compulsion for God to create. He did not need us or the world. He did not need slave labour. He did not create because He was lonely. God doesn’t “have to” do anything! We cannot impose necessity upon God.
Neither was there any external obligation for God to create. God is free of external constraints. God creates because He wants to create (Psalm 135:6). It is His will. God alone has free will because only He has the will to create ex nihilo. Psalm 135:6, “Whatever Yahweh pleases, He does, in heaven and on earth, in the seas and all deeps.” God created because it pleased Him to do so; God creates ex amore (out of love). God creates for the love of it and He loves what He has made. God creates for the love of life.