It's very difficult to overeat good exercise with good food.
If your idea of exercise is to sit around at the gym for an hour and do a couple of lifts, that's not gonna help. I've seen a lot of that. People go there for two hours, but only get like 15 minutes of real exercise done.
But if your idea of exercise is to go on a 10k run, or doing a boxing class for an hour ... well those are going to burn around 700 calories. That's a lot of calories for someone who's supposed to eat 2000 a day.
Eating 2700 calories (your normal 2000, plus the 700 you burned) is hard if you're not eating cake and stuff. I personally struggle every day to keep my weight from plummeting because the amounts of food I have to eat are astounding. Especially on the days when I do a 30km run (that burns 2500 calories).
Honestly, it's taken me over a year of sustained effort to train my metabolism to digest these sorts of quantities of food.
And yes, I am an edge case. My point is that you can outrun a bad diet. It will take a lot of running though.
PS: the biggest mistake people make is thinking that weight == health. You can be skinny and still super unhealthy.