You ask "Why?" because you don't understand the reason God puts you into the situation and where He will bring you from there. The truth is, you can't always understand God's works, but that's alright. You don't have to understand everything. All you need is to believe that God has a beautiful plan for you. Be faithful. Perhaps you can't see it, but that doesn't mean God doesn't have a great plan for you. Perhaps bad things happen, but that doesn't mean God doesn't love you. Have faith and you'll see hope.
God makes everything beautiful at the right time. If it's not beautiful, it's just not the right time yet.
What I always believe is, God never fails. He never makes mistake. Even when bad things happen, God can still use it for something amazing. You know that God works all things together for good. "All things" here means both good and bad things, even when it's caused by your own mistakes. So when bad things happen, look beyond what you see. Don't look to the problems. Look to the beautiful purpose behind it. It's like a movie. To create a great story, the creator must arrange all the good and bad things together before he comes to the great ending. Without all of them, there's no great story.
All you need is to believe. Have faith.
Life is not perfect and that's ok. Sometimes it is just too mysterious. Stop guessing and start doing the right thing. Someday, what you don't understand today will make sense.