God allows bad things to happen because it is His will to allow bad things to happen. But that doesn't mean that God directly causes bad to happen. For example, He does not want people to lie, but he permits them to lie. Likewise, he does not want people to suffer, but he allows people to suffer. In both cases, it is His will to allow people to do bad things.
Ephesians 1:11 says that God works all things after the counsel of His will. The things that we might consider bad, such as getting robbed or breaking a leg by falling down some stairs, would both be bad. Theft is morally wrong, where accidentally breaking your leg is not. He allows both kinds of things to happen to us. Why? Well, we can’t always give a definite answer to every situation, but we can say that God is not surprised by anything and He has a reason for allowing things to occur.
Another explanation as to why God allows bad things to happen is due to Adamic representation. Adam represented us (1 Corinthians 15:22) so that when he sinned in the Garden of Eden, we ended up suffering the consequences of his rebellion. In other words, we are born in a fallen and sinful world because of Adam’s sin. This would mean that God is allowing the consequences of sin to run their course in the world, which includes bad things. Also, we could say this demonstrates how bad sin really is, and God wants to show everyone how bad sin and its effects really are.
Yet another explanation is that God can use bad things to lead to good things. For example, when we look at the crucifixion of Jesus, which is the means by which we are saved from our sins, we see that it was a result of people doing bad things to Jesus. Yet, we are saved by it. Praise God.
Acts 4:27–28, “For truly in this city there were gathered together against Your holy servant Jesus, whom You anointed, both Herod and Pontius Pilate, along with the Gentiles and the peoples of Israel, 28 to do whatever Your hand and Your purpose predestined to occur."
Sometimes we don’t understand why bad things happen. Personally, I suffered the loss of my son shortly after his birth. My wife and I had a funeral for him, and well, we don’t know why God let him die. But, through the years I have been able to relate to other people who have lost children. I’ve been able to offer comfort for them and point them to Jesus - because I know what they’re going through. So, sometimes God allows bad things to happen so that we can help others go through difficulties in their lives.