The beginnings were in British politics where “Whigs” were constutionalists, opposed to absolute monarchy. “Tories” favored the King. (Presbyterians and other dissenters were Whigs.) In the American Colonies in 1776 you were either a Tory (favoring England) or a Whig (favoring independence or revolution). After England was repelled, most Tories fled to Canada or England. (A lot of the early settlers of the upper Hudson River, where I now live, were Tories who fled to Canada. I am trying to find out how the property they abandoned was claimed and divided.)
In the 1780's and ‘90's, the original Whigs divided into “Federalists” and “anti-Federalists.” John Adams and Alexander Hamilton were Federalists, wanting a strong executive branch of government and a national bank to support business and bankers.

This was the party of Jefferson and Madison. By the time of Andrew Jackson, they were just “Democrats.” Are you confused yet? Whigs called Jackson "Jackass," and he took the symbol with pride. Thomas Nast, the political cartoonist, made it famous.
From Jackson’s presidency (1829-1837) onward we are in the “second party” era. Federalists disappeared as a party, and new “Whigs” formed to oppose Jackson, and to oppose the extension of slavery into the new territories of the west. Henry Clay and Daniel Webster were Whigs, as was Lincoln. Goldfield explains how the Republican stance against slavery was at root a pro-growth and pro-business view. Lincoln, after all, was a lawyer for the railroads, and made sure that the transcontinental rail lines were completed, even while the war raged.

The history of these things is much messier than that, but that’s the best I can understand and explain it to this point. Please comment if you think you know more than I, and you probably do. Now I think I can talk about the mid 19th century with a bit more clarity. At some point I need to digress and talk about Presbyterians and Mormons (Oh, yeah), but I will try to remain focused.