The term is of German origin, the concatenation of the root Kapelle (choir) and Meister (master). Kapelle is derived from the Latin word for "chapel", which was typically the center of musical activity during the Middle Ages. Originally, the word was used to refer to somebody in charge of music in a chapel.
In the age of kings in Europe, the term Kapellmeister often designated the director of music for a monarch or nobleman. This was a senior position and involved supervision of other musicians. Johann Sebastian Bach worked from 1717 to 1723 as Kapellmeister for Prince Leopold of Anhalt-Cöthen. Joseph Haydn worked for many years as Kapellmeister for the Eszterházy family, a high-ranking noble family of the Austrian Empire.
Becoming a Kapellmeister was a mark of success for professional musicians of this time. For instance, Haydn once remarked that he was glad his father (a wheelwright) had lived long enough to see his son a Kapellmeister. As society evolved and the prestige of the nobility declined, composers came to value their freedom more highly, and being a Kapellmeister because less prestigious. Thus, Mozart and Beethoven never worked as Kapellmeisters, instead pursuing careers as freelance musicians.