On July 4th 1776 the Continental Congress approved the final wording of the Declaration of Independence after days of editing. July 4th 1776 became the date that was included on the Declaration of Independence, and the handwritten copy that was signed in August. It’s also the date that was printed on the Dunlap Broadsides, the original printed copies of the Declaration that were circulated throughout the new nation. So when people thought of the Declaration of Independence, July 4, 1776 was the date they remembered.
For about 15 or 20 years after the Declaration was written, people didn't annually commemorate it. However by the 1790s the Declaration had become controversial, with the Democratic-Republicans admiring Jefferson and supporting the Declaration versus the Federalists, who believed the Declaration was too French and too anti-British.
By 1817, John Adams complained in a letter that America seemed uninterested in its past. But that was all about to change.
After the War of 1812, the Federalist party began to splinter off and many new parties formed in the 1820s-30s, who considered themselves inheritors of Jefferson and the Democratic-Republicans. Printed copies of the Declaration began to circulate again, all with the date July 4, 1776, listed at the top. The deaths of Thomas Jefferson and John Adams on July 4, 1826, helped promote the idea of July 4 as an important date to be celebrated.
Celebrations of the Fourth of July became more common as the years went on and in 1870, almost a hundred years after the Declaration was written, Congress first declared July 4 to be a national holiday as part of a bill to officially recognize several holidays, including Christmas. Further legislation about national holidays, including July 4, was passed in 1939 and 1941.