From the National Archives:

On September 28, 1789, just before leaving for recess, the first Federal Congress passed a resolution asking that the President of the United States recommend to the nation a day of thanksgiving. A few days later, President George Washington issued a proclamation naming Thursday, November 26, 1789 as a “Day of Publick Thanksgivin” – the first time Thanksgiving was celebrated under the new Constitution. Subsequent presidents issued Thanksgiving Proclamations, but the dates and even months of the celebrations varied. It wasn’t until President Abraham Lincoln’s 1863 Proclamation that Thanksgiving was regularly commemorated each year on the last Thursday of November.

In 1939, however, the last Thursday in November fell on the last day of the month. Concerned that the shortened Christmas shopping season might dampen the economic recovery, President Franklin D. Roosevelt issued a Presidential Proclamation moving Thanksgiving to the second to last Thursday of November. As a result of the proclamation, 32 states issued similar proclamations while 16 states refused to accept the change and proclaimed Thanksgiving to be the last Thursday in November. For two years two days were celebrated as Thanksgiving – the President and part of the nation celebrated it on the second to last Thursday in November, while the rest of the country celebrated it the following week.

To end the confusion, Congress decided to set a fixed-date for the holiday. On October 6, 1941, the House passed a joint resolution declaring the last Thursday in November to be the legal Thanksgiving Day. The Senate, however, amended the resolution establishing the holiday as the fourth Thursday, which would take into account those years when November has five Thursdays. The House agreed to the amendment, and President Roosevelt signed the resolution on December 26, 1941, thus establishing the fourth Thursday in November as the Federal Thanksgiving Day holiday.