In the past century, we have had three Presidents who were originally connected to the Democratic Party in some fashion, but ended up becoming President as Republicans.
Herbert Hoover (1929-1933) originally served in government under Democratic President Woodrow Wilson, providing Belgian relief at the beginning of World War I, and serving Wilson as an aide throughout the war and at the Versailles Peace Conference. He was rumored to be a possible candidate for President in 1920, but was bypassed, and ended up serving as Secretary of Commerce under Presidents Warren G. Harding and Calvin Coolidge, before running for President in 1928.
Dwight D. Eisenhower (1953-1961) served in the military as one of the top generals of World War II under Presidents Franklin D. Roosevelt and Harry Truman, and was offered the chance to run as a Democrat for President in 1948 by Truman himself. When Ike decided to stay nonpartisan, Truman ran for a full term, and then became a critic of Eisenhower, when he ran as a Republican in 1952, and their relationship was frosty for years after until after the assassination of President John F. Kennedy in 1963.
Ronald Reagan (1981-1989) was for many years a Democrat, and active as a labor leader for the Screen Actors Guild. He was a loyal supporter of Franklin D. Roosevelt and Harry Truman, and then had a change of view, due to his marriage to Nancy Reagan and his working for a very conservative oriented corporation, General Electric, and switched his loyalties to the Republican Party, and got noticed when he gave an inspiring speech for the Presidential campaign of Senator Barry Goldwater of Arizona in 1964. Two years later, he won the Governorship of California as a Republican.
So three Republican Presidents of the last century converted from the Democratic Party roots they originally shared!