Answer:
Fins evolved in sharks and dolphins because they developed adaptations for similar environments over time.
Step-by-step explanation:
Dolphins and sharks are very different. Their common ancestor is far in evolution, and it has been a long time since these two lineages got separated, or diverged. And too many changes have occurred since that divergence.
Sharks are cartilaginous fishes that have evolved from marine animals that have always been in the water. Cetaceans are mammals that evolved from other animals that were first in water, then inland, and then they came back to the water.
Nowadays, these two species share the same environment, and they have adapted to it by developing different structures which are very similar in the two species, such as Lack of hair, Hydrodynamic body shape, Caudal fin, Pectoral fins, etcetera. The Dorsal Fin is an analogous trait that guarantees stability in the water while the animal is moving.
Natural selection has dotted cetaceans with these adaptations to the aquatic environment that they share with sharks and other fishes.
Since dolphins have developed a body structure very similar to that of the shark, due to similar selective pressures acting in both species, but with clearly different origins, we can conclude that this is a case of convergent evolution.