Michael Phelps did outswim his diet. He famously ate a lot of junk food and pizza, and yet remained fit because of his huge daily calorie expenditure. A direct quote from an interview with him, where he states: "I just sort of try to cram whatever I can into my body. It’s pretty much whatever I feel like eating, I’m going to eat".
I think the challenge with swimming is that there is thermodynamics of swimming through water to also contend with. So your body is also having to keep warm whilst losing heat to better heat conducting fluid (water vs air). But I still agree, if Phelps was running or even walking with the same effort he could eat similarly.
I don't know about possible, but I'm sure the Michael Phelps regimen is wildly impractical for everyone, including Michael Phelps.
My personal experience is that "outrunning" a poor diet is absolutely possible, and I kind of did it unintentionally. I started biking to work out of necessity. I wasn't planning to lose weight, but it happened. I had no weight loss ambitions or plans, but it was probably a good thing.