In the final analysis the questions of why bad things happen to good people transmutes itself into some very different questions no longer asking why something happened but asking how we will respond what we intend to do now that it happened.
If you continually diet you are putting your body in a quasi-famine situation. It slows your metabolism down and breaks the thermostat. Diets don't work. They don't help you understand why you're eating more than your body wanted in the first place.