We honestly don't always know why evil things happen. The Bible says evil is real -- but it also says that its true nature is often hidden from us, and sometimes that's all we can say (see 2 Thessalonians 2:7).
The Bible doesn't teach, however, that whenever something bad happens to us, God is punishing us for something we've done wrong. God isn't a harsh, mean policeman who is just waiting for us to get out of line so He can punish us -- not at all. God loves us, and even when hard times come to us, we can turn to Him for the strength and comfort we need. The Bible says, "The Lord is gracious and compassionate, slow to anger and rich in love" (Psalm 145:8).
Does this mean we can sin all we want to and never suffer any consequences? No, of course not. Sin always contains within it its own punishment. If I ignore God's laws about healthy life, I'll suffer the consequences; if I flaunt His commandments about moral living, I'll suffer the consequences. When this happens, I alone am responsible for the bad things that result from my sinful behavior; I can't blame God. The Bible warns, "Do not be deceived: God cannot be mocked. A man reaps what he sows" (Galatians 6:7).
The good news is that God has provided the way -- not only for our sins to be forgiven, but for us to experience a new life. That way is Jesus Christ. Accept His gifts of forgiveness and newness of life by asking Him to come into your heart today.