The term "bachelor" in the context of education came from the Latin "baccalaureate", a word which we still use today. Master comes from "magister" which means teacher.
The precise definition of baccalaureate is however very variable. In much of Europe it refers to what Americans would call the last years of highschool.