There is no harder question in all of life and theology than this one. And the answer isn't any easier, but let's dive into it.
First, we need to rethink our definitions of "good" and "bad". According to the Bible, there are no truly "good" people. Yes, that sounds harsh, but hold on. Before you click away, remember that "good" does not refer to the nice guy who walks his dog daily, helps old ladies across the street, and serves at the local homeless shelter. When we are talking about "good" in this context, we are referring to righteousness. To be righteous means that you are blameless before God. Strictly speaking, instead of saying, "She is good," it actually would be more accurate to say, "She is less bad."
The Bible is incredibly clear in that there is no one who is righteous before God because we are all tainted by sin from birth. We are completely unable to rid ourselves of that sin without accepting Christ as our Savior. Sin is what He is saving us from. Check out Romans 3:10-18:
"There is none righteous not even one; there is none who understands, there is none who seeks for God; All have turned aside together they have become useless; There is none who does good, there is not even one. Their throat is an open grave, with their tongues they keep deceiving, the poison of asps is under their lips; whose mouth is full of cursing and bitterness; their feet are swift to shed blood, destruction and misery are in their paths, and the path of peace they have not known. There is no fear of God before their eyes."
You can also look up Ecclesiastes 7:20, Romans 3:23, and 1 John 1:8 to see more passages that clearly express how there is no one who is naturally righteous or good. That includes you and me. Why is this so important? Because God is unchanging, and He cannot tolerate sin. God literally cannot stand our sinful nature. It's always uncomfortable to say that God cannot do something, but if you think about it, this is a good thing. Do you want God to be able to change His mind? If we had a God who could change His mind, then how could we ever trust His promises?
We all deserve Hell—every last one of us. Sounds scary? Well, yes, it is! There is no way around it. There is no sin, no fib, and no bad attitude so small that does not sentence you to that fate. God is a righteous, holy God who cannot tolerate even what we feel is the smallest sin. And this is why the gospel is called the Good News. Christ was the only One who could pay the price for our sin. And He did. And then freely offers us our salvation from what we deserve. All we have to do is receive Him as our Lord and Savior (John 3:16, Romans 6:23, Romans 10:9, Romans 5:8).
Now, let's go back to the original question and tweak it slightly: "Why does God allow bad things to happen?" In the same way that "good" isn't the same to us as it is to God, what seems "bad" to us is not necessarily what is "bad" to God. See, His perspective is so much bigger than ours, and He knows a lot more about the big picture than we do.
We cannot know everything that is inside the mind of God, but what we do know is that God is good (in the definition established above) though our minds cannot fully grasp Him. We live in a fallen world, all of which is touched by sin. But we can rest assured that nothing is outside of God's control. And He knows the whole story from beginning to end and what will happen after the smoke has cleared.
After witnessing an unspeakable tragedy, we're living in the moment. Everything is immediate and urgent and horrible and impossible to understand as we look at the ashes of what's left behind. Why would a loving God would allow these things to happen?
One thing I have found comforting when bad things happen is to stop and realize that everything we are seeing is the now. We do not know how the Lord will use this event to shape the future. And we are left with two choices:
Being angry (and staying angry) with God will get us nowhere fast. So we must trust in the Lord, know He is in control, and know that no matter how bleak things may seem, nothing can change His goodness, or tear His children away from His gift of salvation and eternal life.
According to the Bible, there are no truly "good" people. To be "good" is to be "righteous." To be righteous means that you are blameless before God, and the only way we can achieve that is by accepting Christ as our Savior to save us from our sin (Romans 3:10-18; Ecclesiastes 7:20; Romans 3:23; 1 John 1:8). We live in a fallen world, all of which is touched by sin, and bad things will happen to everyone at some point. But nothing is outside of God's control. He knows the whole story from beginning to end, and His perspective is much bigger than ours. We may not understand what's happening (Proverbs 3:5-6), but we can trust that everything will work out according to God's perfect will (Romans 8:28).
Heidi Joelle spends her days staring at paperwork and making sure it is where it is supposed to be, how it is supposed to be, when it is supposed to be. And then she comes home and makes sure the porky little dog isn't eating a trashcan. Between these two events, she tries to learn and see as much of the world around her as possible.