It actually has the same origin as the parent poster of your comment:
Late Old English mægester "a man having control or authority over a place; a teacher or tutor of children," from Latin magister (n.) "chief, head, director, teacher" (source of Old French maistre, French maître, Spanish and Italian maestro, Portuguese mestre, Dutch meester, German Meister), contrastive adjective ("he who is greater") from magis (adv.) "more," from PIE mag-yos-, comparative of root meg- "great." The form was influenced in Middle English by Old French cognate maistre.
Late Old English mægester "a man having control or authority over a place; a teacher or tutor of children," from Latin magister (n.) "chief, head, director, teacher" (source of Old French maistre, French maître, Spanish and Italian maestro, Portuguese mestre, Dutch meester, German Meister), contrastive adjective ("he who is greater") from magis (adv.) "more," from PIE mag-yos-, comparative of root meg- "great." The form was influenced in Middle English by Old French cognate maistre.
Source: https://www.etymonline.com/word/master