Duke of Guimarães was an Nobility title granted by King Afonso V of Portugal in 1475, to Ferdinand II, 3rd Duke of Braganza. The king just upgraded the previous title of count of Guimarães, that he granted to the same Duke of Braganza, some years before (in 1464).
When Isabel of Braganza married Infante Duarte, King Manuel I of Portugal's youngest son, her brother, Teodósio I, Duke of Braganza ceded the dukedom as her dowry, and Duarte became the 4th duke of Guimarães. As their son (Duarte II, 5th duke of Guimarães) died without issue, the dukedom returned to the crown, but was soon granted again to the House of Braganza, when king Philip III of Portugal, gave it to John II, 8th Duke of Braganza.
"Nobreza de Portugal e Brazil" - Vol. II, pages 651-652. Published by Zairol Lda., Lisbon 1989.