One of the ancient Celtic traditions of Scotland and Ireland was, in much the same manner as for American slaves, that all the serfs who worked his land used the name of the clan chieftain.
In Gaelic, the prefix Mac means “son,” while O means “grandson” or “descendant of.”
Both were used to keep track of the true bloodline.
MacDonald means “the son of Donald,” while O’Connor means “the grandson of Connor.”
And that’s why so many Scottish and Irish surnames begin with “Mac” as in MacDonald, and “O” as in O’Connor.