No, the megalodon shark is not a dinosaur. While there is some debate, megalodon is classified either within the genus Carcharodon or Carcharocles. Under Carcharodon is would be considered a relative of the modern great white shark. Under Carcharocles it would have been the last remaining species of big-toothed sharks.
Either way, the megalodon was a shark, not a dinosaur.
In fact, megalodon didn’t even live at the time of the dinosaurs. While there were prehistoric sharks back then, megalodon did not evolve until around 23 million years ago. The extinction that wiped out the dinosaurs occurred 65 million years ago, putting a 40-million-year gap between megalodon and the last known dinosaurs.
While meg may not have been around back then, some of its relatives were. Otodus was a massive, 30-foot shark and, while not as big as megalodon, it was a formidable ocean predator. There were also terrifying marine reptiles such as Liopleurodon, and Shastasaurus, which grew to the size of a megalodon shark.