The first reason is that dolphins have a powerful sonar system that interferes with the brains and nervous systems of other marine animals, rendering sharks incapacitated for a short period of time.
The second reason is that dolphins tend to live in groups and will organize together to ram the sharks, which can damage their internal organs.
The third reason is that dolphins are very flexible, more sensitive and swim faster.