There are many theories explaining how megalodon one of the biggest predator shark got extinct. Most scientists still believe that these sharks got extinct about 1.5 million years ago, but it is quite amazing how these enormous creatures got extinct, they were so huge and powerful that they could even hunt down a whale quite big then their size.
GLobal ocean cooling:
Some times scientists believe that few million years ago a great global subfreezing event took place freezing most of the ocean and hence might be a factor in extinction of the greatest predator machine of the world.
According to scientists the closure of central American seaway caused a dramatic change in climate across the globe, in aftermath additional glacification started near northern hemisphere resulting in significant temperature decrease across the oceans, Megalodon shark who love to swim in warm waters found this situation really difficult and there natural breeding places got in trouble hence decreasing their population dramatically which eventually resulted in their extinction in an age called ice age.
Decline in food supply:
As the central American sea way was closed much of the marine life forms were at risk, the great whales started migrating towards the polar region and hence a food shortfall started for great Megalodon as great whales were in their primary food chain, megalodon could not migrate towards polar region as they were quite cold, hence some scientists believe that food short fall due to dramatic climate change across the globe might be one of the main reason of extinction of megalodon shark.
There is no doubt that megalodon was the one of the biggest predator but there was even bigger predator then carcharodon megalodon they were called raptorial delphinids who exclusively hunted down megalodon shark some scientists believe this also misht be a reason that megalodon shark got extinct.