The Second Continental Congress passed the Lee Resolution on July 2, 1776.
Richard Henry Lee of Virginia introduced the resolution on June 7, 1776. Its central proposal stated that the United Colonies should be free and independent states, released from allegiance to the British Crown. Congress debated the proposal while waiting for several colonies to authorize their delegates to support independence.
On July 2, Congress approved the resolution. John Adams considered that date the true birth of American independence and expected it to be remembered with celebrations. Two days later, on July 4, Congress approved the wording of the Declaration of Independence, which explained and justified the decision made through the Lee Resolution.
The two dates are therefore connected but not interchangeable. July 2 concerns the formal vote for independence; July 4 concerns adoption of the public declaration. The later date became the national holiday because the Declaration was the document widely circulated and remembered.