Marine Biofag here,
Look, it depends on the species of shark and the kind of dolphin. It's kind of the lion vs tiger debate. Both are pretty badass in their own way, but a blanket statement favoring one or the other is downright ignorant.
Yes, a big bottlenose can mess up, say, a blacktip or a lemon shark, but on the flip side a big mako, tiger, or blue will probably be able to kill that same dolphin.
Dolphins just get a lot of good press, because they're all cute and easily likable. So it's mostly an urban legend.