Isa 43:7 everyone who is called by my name, whom I created for my glory, whom I formed and made.”
Psa 19:1 The heavens declare the glory of God, and the sky above proclaims his handiwork.
Rev 4:11 “Worthy are you, our Lord and God, to receive glory and honor and power, for you created all things, and by your will they existed and were created.”
God created the universe for His glory. It was a free will act of God, like we see in Rev. 4 above, which means He did not have to do it, but chose to do it. It was a demonstration of God’s excellence, making His attributes clear for all to see.
We should always remember that we are here as a result of, and subject to the mercy of God. Just as His decision to create the universe was a free will decision, so is His mercy.
Did God then create evil too? We are not told exactly how Satan became evil, except that he wanted to be as great as God, and was subsequently cast out of heaven. That will of Satan to try and become as great as God was the beginning of evil, and while do not contend that God directly created that will, but if God did create everything, that includes Satan, his will and the consequences.
However, as we saw above, all creation is for the glory of God, so that logically will include anything that we see as evil. The fall of Lucifer and his responsibility for delivering sin and evil into the world brings glory to God because it demonstrates God’s grace.
In the same fashion we can show that everything brings glory to God, the ultimate purpose behind our existence and that of the universe.