The idea is that some people can get the training but they aren't able to do the job. Since they have the training they often have the qualifications to teach and that ends up being the only place where they can get hired.
Thnk of it this way:
John goes to University and gets his degree in Accounting.
John applies for jobs after he gets his degree and gets one working in the accounting department at a company.
But John is terrible at his job and doesn't get along with any of his co-workers so he quits that job and works at some other company. That ends the same way.
After a while John will get a bad repuattion in the industry and people won't hire him.
So since John can't get a job in the industry but he does have the education, he gets a job teaching other people how to do accounting.
John can't do the accounting job so he teaches others how to do it instead.
The phrase is usually used as a way to tease people who are teachers but most of them don't take it very kindly!