Bad things do not happen because you are good or because you are not good. You must have done something bad in the past and that karma is showing up now. You have to face the consequences.