This interesting name, with variant forms, Duffie, MacDuffie, McFee, McPhee, D'Duffie and O'Duhig, is an Anglicization of the ancient Gaelic personal name "Mac Dhubhshith" a compound of elements, "mac" meaning "son of" plus "dubh", "black" and "sith", peace, hence "son of the black one of peace". The name was borne by a 6th Century saint who was also Archbishop of Armagh. The name is one of the oldest, most interesting, and widespread in Scotland, while also prevalent in all provinces of Ireland except in Munster, where the variant is known as Duhig. Johannes Macdufthi appears as a charter witness in Dumfridshire, in the reign of Alexander 11 of Scotland (circa 1180). Church Recordings include one John, son of John Duffy, who was christened on May 30th 1570, at St. Giles' Cripplegate, London, and James Duffy married Jane Armonette on December 17th 1684, in London. James Duffy, a famine emigrant, embarked from Londonderry to New York on board the "Mary-Harrington", on June 2nd 1846. The first recorded spelling of the family name is shown to be that of Thomas Macdoffy, who rendered homage, which was dated 1296, in the "Calendar of Documents relating to Scotland, during the reign of King John Balliol of Scotland, 1292 - 1296. Surnames became necessary when governments introduced personal taxation. In England this was known as Poll Tax. Throughout the centuries, surnames in every country have continued to "develop" often leading to astonishing variants of the original spelling.
Hope this helps.