At first it might seem that if God created all things, then evil must have been created by God. However, evil is not a “thing” like a rock or electricity. You cannot have a jar of evil. Evil has no existence of its own; it is really the absence of good. For example, holes are real but they only exist in something else. We call the absence of dirt a hole, but it cannot be separated from the dirt. So when God created, it is true that all He created was good. One of the good things God made was creatures who had the freedom to choose good. In order to have a real choice, God had to allow there to be something besides good to choose. So, God allowed these free angels and humans to choose good or reject good (evil). When a bad relationship exists between two good things we call that evil, but it does not become a “thing” that required God to create it.
Perhaps a further illustration will help. If a person is asked, “Does cold exist?” the answer would likely be “yes.” However, this is incorrect. Cold does not exist. Cold is the absence of heat. Similarly, darkness does not exist; it is the absence of light. Evil is the absence of good, or better, evil is the absence of God. God did not have to create evil, but rather only allow for the absence of good.
God did not create evil, but He does allow evil. If God had not allowed for the possibility of evil, both mankind and angels would be serving God out of obligation, not choice. He did not want “robots” that simply did what He wanted them to do because of their “programming.” God allowed for the possibility of evil so that we could genuinely have a free will and choose whether or not we wanted to serve Him.
As finite human beings, we can never fully understand an infinite God (Romans 11:33-34). Sometimes we think we understand why God is doing something, only to find out later that it was for a different purpose than we originally thought. God looks at things from a holy, eternal perspective. We look at things from a sinful, earthly, and temporal perspective. Why did God put man on earth knowing that Adam and Eve would sin and therefore bring evil, death, and suffering on all mankind? Why didn’t He just create us all and leave us in heaven where we would be perfect and without suffering? These questions cannot be adequately answered this side of eternity. What we can know is whatever God does is holy and perfect and ultimately will glorify Him. God allowed for the possibility of evil in order to give us a true choice in regards to whether we worship Him. God did not create evil, but He allowed it. If He had not allowed evil, we would be worshiping Him out of obligation, not by a choice of our own will.