Why do PhDs become homeless?
In reality, few PdDs wind up homeless. A few do, and at certain times more do. But, in general, it shouldn't be a concern for someone wanting to study for a doctorate. But occasionally...
There are a lot of factors. The general state of a nation's economy at the time you finish can have a lot to do with it. When I finished (1970's) there were almost no jobs for mathematicians. We had landed on the moon and all money for science suddenly dried up for several years. I was lucky to stay in academia at all, and many PhDs at the time were pumping gas, etc. It cleared up in a few (several) years.
Some people get a doctorate not intending to use it for anything but the love of knowledge. Some turn out to be writers.
Ted Kaczynski (the Unabomber) was evading capture by the police.
Lots of reasons.
At the current moment there is a glut of doctoral graduates relative to the market for those skills in many fields. Academia in general graduates more PhDs in a given year than there are positions open in academia. So the system depends on jobs being available elsewhere. Sometimes that is true and sometimes not.
A lot of people take jobs below what their skills and education would require, such as teaching school with a doctorate.
And, as to bad life decisions, it is impossible to say. Having a job shouldn't be your highest lifetime goal, actually. Moreover, because of the length of time it takes to earn a doctorate the economy and the demand for your skills can change drastically before you finish. This is what happened to me. When I started grad school everyone would predict a bright future for a mathematician. When I finished, not so much. Nothing, really. I looked into becoming an actuary, for example. And, I switched fields to CS to become more employable in the short term.
But, I'm glad things are better in Kenya. Here (US) politicians have decided to drastically decrease funding for education at all levels. The feeling among some of them is that it is up to you, not society, to see to your education. This is a great way to assure that the population gets dumber and dumber and poorer and poorer over time. I have an opposite view that an educated populace is a national resource that shouldn't be compromised. Silly me.
Postscript: I didn't interpret the question as "Why do so many...". I don't see that implication anywhere in the original post.
They do not "become homeless". This is a myth.
It's as simple as that. Or at least the implied softer statement that a person with a PhD is somehow more at risk of unemployment than other groups of people. Obviously, there is bound to be some unemployment even in that group, just by chance; unfortunate accidents can happen to anyone. But on the whole, a PhD is protective against unemployment, and for many reasons other than the simple topic studied (e.g. a boatload of transferable skills, for one, opening far more doors than their narrow topic of specialization might imply).
Your question is an example of the Bulverist Fallacy, i.e. presenting a loaded argument of the form "A is true. Why is A true?". Any attempt at answering this question that jumps straight into "Why" is fallacious to the extent that it has not addressed whether A is in fact true or not.
As for your specific question, the answer is that it simply is not the case. People with PhDs are far less likely to be unemployed than people without one.
https://www.sciencemag.org/careers/2016/05/employment-crisis-new-phds-illusion
Now, if and when they are in the minority of people who do end up unemployed for whatever reason, Buffy has an excellent answer on the kinds of reasons that might lead to that. But it's worth nothing that you might as well have asked "Why are there so many unemployed green aliens on earth"? The answer would have been equally valid. In that it's mostly not, simply because the premise is largely untrue in the first place.
To add another perspective to this, there are two important factors that make people start a PhD, not least of which is a misconception about their likelihood of success.
The glut in PhD candidates is partially fueled by faculty members misrepresenting one's prospects post graduation. Doing a PhD in the hopes of securing a position in an R1 faculty position is, statistically speaking, a (very) risky prospect - lots of good people competing for very few positions.
Of course, faculty members who are already in these positions suffer from observation bias, and see their road to these positions as straightforward, whereas it is in fact far from it. I don't think that faculty members who encourage people to enter grad school are being malicious: they genuinely believe that their success can be replicated with hard work and determination; this is often not enough to succeed (there's a tremendous amount of luck, and qualities like creativity that are hard to teach). School recruitment of course has no interest in telling you otherwise - they want to keep those enrollment numbers high, thus you may get very skewed signals.
One might say that even after graduation students are still (weakly) more employable than they were before studies. This is probably true (you probably won't become homeless!), however, you are not factoring in lost wages, job experience, and losing what are probably your best years career development wise.
As an example, some people (in CS and related disciplines) start their PhD under the false impression that it will improve their chances of securing a software engineering job. As I cover in this answer, you stand to lose roughly $500k++ (probably more) by simply entering the PhD program. While you won't end up being homeless (probably) if you graduate with a CS PhD, losing out on this amount of money in sunk costs/lost wages is something that most graduate students don't even consider when entering the program (at least not the ones I had a chance to interact with).
This is not counting time spent doing a postdoc, or adjunct teaching. Both positions pay peanuts (I think in some disciplines you're better off financially by flipping burgers), and that's again time and wages lost.
To conclude, people tend to romanticize academia, and overestimate their chances of succeeding after graduation. This tends to lead to them making poor choices, and unfortunately, faculty members/recruiters often enough are not helping them understand what they're getting into.