I have been asked that question many time. I would first note that some things happen because of choices and decisions you have made. If you eat and have a horrible diet in all probability, there will be health consequences. If you enjoy driving fast and end up getting into a car accident. There is a reason. In each of those scenarios asking God, "Why is this happening to me is not really the best question to ask."
Some things happen because of choices or decisions other people make. You could be receiving medical treatment, and the doctor or nurse doesn't read the label correctly and you receive a dose of the wrong medicine.
In the Bible we read of Joseph. He was one of 11 other brothers from the patriarch Jacob. Jacob favored Joseph more than the other boys. God gives some dreams to Joseph. He shares them with the family. His brothers get jealous. Sell him off into slavery and lie to dad about what happened. Joseph goes to live in Egypt and things go from bad to worse. Then one day it miraculously all changes. Joseph becomes the second most powerful man in Egypt. Then one day his brothers come to see him not knowing it is him.
The story unfolds very dramatically. At one point Joseph tells his brothers. Genesis 50:20 "What you meant for evil God has used for good."
I have been a pastor for 40 years. I have worked with people and families at various stages, phases, and circumstances of life. Sometimes - Life happens. Bad things happen. Heartache, pain, suffering happen. I wish they didn't. But it is part of life.
BUT... If you give God permission, time and opportunity to do what only he can do, he will bring something powerful and good out of it.
It is amazing to me in working with people. I've had people tell me that they left the church. They left walking with God because of some event, circumstance, death of loved one or some sort of tragic event. My heart aches when I hear those words. But I also heard people tell me... People who walked through some very similar circumstances as the first group... that they came to God because of those events, circumstances or tragic event.
It comes down to how we view God. Things happen, but with God he can takes those moments and weave a tapestry of beauty out of it.
So does everything happen for a reason in my opinion is a good question. But there is a better one: What is God doing in the circumstances or tragedy that I am in right now. As my mother used to tell me -- be sure to stop. Look. And listen. And hear the whisper of God as he is with you in that moment.