Master and minister are etymological opposites built from the same Latin blueprint. Latin magister combines magis ('more') with the agentive suffix -ter, producing 'the greater one' — a chief, a teacher, a director. Minister does the same with minus ('less'): the lesser one, the servant.
The root is Latin magnus, 'great', from Proto-Indo-European *meǵh₂- with the same meaning. This root is one of the most productive in English. Through Latin it gave us magistrate (one who exercises authority), magnificent (doing great things), magnify (to make great), magnitude, and major (the greater).
The word entered English twice: once through Old English mægester (borrowed early from Latin) and again through Old French maistre after the Norman Conquest. The French form eventually dominated, giving the modern spelling.
Across Europe, the word adapted to local prestige. Italian maestro became the title for conductors and composers. German Meister produced the compound Meisterwerk — masterwork. French maître survived in maître d'hôtel, shortened in English restaurants to maître d'.
The academic degree Master of Arts preserves the original Latin sense most faithfully: magister artium, 'the greater one in the arts' — someone who has demonstrated sufficient knowledge to teach.