The story
Sir was formerly a common title of address for the clergy as a translation of Latin dominus, the term used for a bachelor of arts, originally in contradistinction from the magister, or master of arts.
Etymology from Wiktionary, CC BY-SA 4.0.