c. 1300, "young man;" also "youthful knight, novice in arms," from Old French bacheler, bachelor, bachelier (11c.) "knight bachelor," a young squire in training for knighthood, also "young man; unmarried man," and a university title. Of uncertain origin.
Perhaps from Medieval Latin baccalarius "vassal farmer, adult serf without a landholding," one who helps or tends a baccalaria "field or land in the lord's demesne" (according to old French sources, perhaps from an alteration of vacca "a cow" and originally "grazing land" [Kitchin]). But Wedgwood points out that the baccalarii "were reckoned as rustici, and were bound to certain duty work for their lord. There is no appearance in the passages cited of their having had any military character whatever." (He favored a Celtic origin).
Or perhaps from Latin baculum "a stick," because the squire would practice with a staff, not a sword. "Perhaps several independent words have become confused in form" [Century Dictionary].
The meaning in English expanded by early 14c. to "young unmarried man," late 14c. to "one who has taken the lowest degree in a university." Bachelor party as a pre-wedding ritual is by 1882.