Yes, you can. I know it's the thoughtful personal trainer cliché to say you can't outrun a bad diet, but the reality is, you can.
Well, I am not sure if you can.
Some people very clearly do outrun (by this, I mean, out-exercise) their bad diet. By this, I mean that they are able to maintain a relatively lean physique despite what seems to be a very high caloric intake. Let's take the following example...
If I begin eating 4000 calories, and my maintenance calorie intake is 3200, I will gain weight. If I then add an hour of exercise which, for argument's sake, burns 600 calories (during and after), I will be left gradually gaining weight, more or less. Now, if I add another hour and maintain the same intensity, I will burn another 600 calories. Now, I am
losing weight while eating 4000 calories, as my new total daily energy expenditure (TDEE) is 4400 calories.
While simple arithmetic doesn't apply so simply in human physiology, it is illustrative of the underlying point. That is, you can exercise more to boost your energy expenditure, allowing you to eat more overall calories and thus facilitate a "bad diet" (depending on what foods you choose, of course).
So, where's the catch?
Well, firstly, you are now exercising 2-hours per day, 7-days per week. If you are a competitive athlete, that may not be a problem. But, what about if you are a busy professional with kids at home and other hobbies or family obligations? Well, 14 hours a week now seems like a very big commitment.
Additionally, when exercise is thought of as no more than a tool for calorie burning, this can result in psychological consequences in the short and long term. You now view exercise as something that justifies what you eat, rather than something with a larger purpose that sustains you. Not only can this compromise your relationship with food and body
image, but it can also reduce exercise motivation long term. If you ever decide not to bother trying to lose weight, then what is the exercise for now? Maybe you can now eat more without doing that exercise, since you are not trying to achieve a deficit anymore? And thus your purpose for exercise is gone, and so too may be the health benefits associated with it.
Finally, it's important to note that a "bad diet" is not just about calories or impact on body composition. If you consume a diet rich in saturated fat, low in fibre, insufficient in micronutrients and phytonutrients, you will still leave yourself with elevated risk of cardiovascular disease, neurodegenerative disease, cancer, and more. Diet and health
does not stop at its effects on how you look!
In summary, this brief overview should make clear that more exercise can allow you to eat a worse diet; one that is richer in calories and lower in quality. This does not mean there will not be consequences, as nutrition and health is a long-term commitment. There are other nuances such as adaptations to exercise, chronic under-recovery, injury risk, and
more, and all of these simply serve to clarify the point that you can outrun a bad diet and still get / stay lean, but this does not mean you should.