You'd be surprised. Exercise alone won't sort out someone who eats like shit, true, but let's say someone with a caloric requirement of 3000 calories per day is eating 2400 on a calorie controlled diet. That's a 20% deficit, which is pretty standard for good weight loss progress.
Now let's say he swims for an hour. I don't have my calculators on me but a larger man swimming at moderate intensity (elevated heart rate and slight panting but no oxygen debt) can burn about 200 calories in an hour, if I recall correctly.
Now, he's eaten 2400/3200 calories, since the energy requirement for the day went up to reflect his more vigorous than usual activity. That's now a 25% calorie deficit instead of a 20% one - a huge difference in weight loss terms. (I recommend a deficit of no more than 30% for sustainable long term weight loss.)
Meanwhile his cardiovascular health has increased, his muscles have strengthened and he's had an endorphin release, not to mention the arguable effect on his metabolism. Statistically and psychologically, he is now much more likely to keep losing weight diligently without giving up.
Basically, a little exercise goes a long way.