In the beginning, God created the universe in 6 days and declared that his work was very good. It was perfect. The man and woman he put in the garden of Eden were as perfect and eternal as the world he made. He gave them but one rule – perhaps as a demonstration of their love for him to obey: “Don’t eat the forbidden fruit or you will die.” But, they made the choice to disobey that damned humanity and cursed the world to its imperfect, broken state. It’s all because of Adam and Eve’s sin (see Gen. 3.16-17). When God cursed the formerly perfect, now sinful couple, he cursed their children and the entire universe with the promised death they chose by eating the forbidden fruit. Because of the curse, suffering, deterioration and brokenness exists. That is an underlying factor in bad stuff happening.
But God doesn’t let evil and bad stuff go wild. The wonderful part of our God is his mercy to limit evil and bad stuff. He chooses to intervene at special times in miraculous ways to help suffering. It is only through his goodness and mercy that anything good happens. When it does, we thank him as we see his glory demonstrated. It’s like the case of the man born blind in the Bible. “And his disciples asked him, “Rabbi, who sinned, this man or his parents, that he was born blind?” Jesus answered, “It was not that this man sinned, or his parents, but that the works of God might be displayed in him.” (John 9:2-3, ESV) Jesus healed the man to reveal his power to do so as the son of God.
Another example was the children of Israel living in Egyptian exile 400 years. Near the end, they grew so powerful that Egypt, out of fear, made them slaves to control them. They endured the bad stuff life of slavery for decades before God sent them a deliverer. And it got worse for a while before it ended. Why allow it? Why so long to stop it? Only God knows. We can see after the fact how God limited the evil and how he blessed them, even using the events to foreshadow the Savior that would come much later.
Summing up the points, bad stuff happens in the world because we are sinful, broken people living in a broken universe, all brought on by the failure of the perfect first couple, Adam and Eve. Bad stuff happening is the necessary consequence of sins we do and the broken universe that is unruly. Yet, God in his mercy intervenes when it suits his purposes to alleviate or mitigate certain suffering to demonstrate his power and glory. So, God doesn’t deserve our malice for allowing bad things happening that mankind deserves, but only our thanks for his mercy and goodness to care for us, answering our prayer requests with yes, no or wait for my time.