Whales are larger than elephants but water density may help mitigate against gravitational issues. Some early dinosaurs may have been exclusively water creatures.
The largest dinosaurs, sauropods, had zero adaptation for any sort of an aquatic life and nobody believes they lived in water any more. For starters, they would have needed snow shoes; the feet they actually had would have gone straight into muddy river bottoms and they would have spent their entire lives standing in one place. Likewise their teeth show the wear and tear of eating branches and leaves, you don’t get that from soft aquatic vegetation.