Bachelor now carries the sense of an unmarried man but in Middle English, when it first entered the language, it had the meaning of a young knight serving under another’s banner because he was not old or wealthy enough to have his own followers.
The modern sense emerged at least by Chaucer’s time, in the 14th Century, for he uses it in that meaning.
The Old French word, bacheler, derives from the Italian baccalare, but from there it is uncertain. One theory is it comes via the Late Latin baccalarius, a vassal farmer. A baccalaria is a field belonging to a lord, which is likely related to vacca, meaning cow. Another theory understands that the word is related to the Latin baculum meaning ‘stick’, due to young knights training with sticks.
By the 14th Century bachelor had come to mean guild members, young monks, or students at universities. From this we obtain the sense of a bachelor’s degree.