Why do students go for a PhD even when chances of getting academic jobs on its completion are slim?
The issue is that the frame of your question is wrong. You’re assuming that the purpose of a PhD is to get an academic job, when that is not the case: Many people who get PhD’s have no desire for an academic job, even from the time they apply!

The number of academic positions is indeed insufficient to absorb all the PhD’s. But there are lots of other “landing spots”:


Industrial research and development
Start-ups
Non-university government research institutes (like the US NIH or DOE lab system, or the Max-Planck-Instituts in Germany)
Finance and consulting
Administrative and Supervisory positions in other disciplines.


Overall, PhD’s have a lower unemployment rate than non-PhD’s. It’s all a question of where they want to go.

As for doing a PhD, the basic skill it teaches you—the one that makes you valuable to lots of people—is the ability to learn new fields quickly and become an expert in those fields. You don’t always need specialized knowledge in your PhD topic to get into an area.

But ultimately the reason for doing a PhD is the love of research and discovery. People pursue research careers because that’s what they want to do.