I don't know why horrible things happen, that's a pretty broad question and 'horrible things' covers a lot of different scenarios - even if you just use this site to look at the different types of trauma that can happen to people, you've got everything from natural disasters to torture. The impact might be similar for different people, but the cause isn't. Then 'horrible things' could also cover illness, bereavement, relationship breakdowns, losing pets....all horrible, all part and parcel of life to some degree. I think we tend to focus on the negatives though, that they linger with us more, often at the cost of either not seeing or forgetting all the little good bits that happen along the way too. Why do good things happen?
What I do think is that your logic is flawed and it might be helpful to you to spend some time examining it. (Ignoring for a second that you are not a bad person anyway - you're not) if we work with your premise that you are bad and that that is why horrible shit is going to happen to you, how does that work? Do all bad people really get the horrible stuff happen to them your logic says they deserve? Do you really believe that horrible stuff is reserved for bad people? If so, what does that say about everyone here on this site that has had horrible stuff happen to them? Does everyone who gets sick, get sick because they are bad? ........when you start pulling it apart it doesn't make sense