The idea behind this proverb is that people who teach are people who have failed at other things. Here are some examples:
Let us say that someone has become a music teacher. Presumably, they have become this because they were not good enough to become a great musician or even a musician good enough to make a career out of it.
Let us say someone has become a coach in some sport. Presumably, the person has done this because they are not good enough to actually make a living playing the sport.
In other words, the idea here is that if you were truly good at something, you would make your living doing it, not teaching others to do it.