Why did the US get basically all land East of the Mississippi when the Thirteen Colonies seemed to end at the Appalachian Mountains?
The United States got possession of all land west to the Mississippi in the Treaty of Paris at the end of the Revolution due to some fine and sneaky diplomacy by Benjamin Franklin, and as a possible indirect consequence of Spanish entry into the war against Britain.
Prior to the Revolution, despite western land claims of many of the 13 colonies, Britain had tried to restrict the colonial borders to the Appalachians. A Royal proclamation of 1763 restricted the western boundaries of the 13 colonies to the Appalachians. The “Quebec Act of 1774” gave control of the land between the Appalachians and the Mississippi north of the Ohio River to Quebec. This was not popular in the 13 colonies, and was among the causes of the Revolution.
Britain might have wanted to keep hold of this territory after the revolution but ended up conceding it in the Peace Treaty.
Spanish obsession with winning back Gibraltar from the British served to enable the US to get better terms at the peace settlement.
According to treaties, America could not make peace with Britain independently from France. France, however, by a secret treaty, could not make peace independently from Spain. Furthermore, France had (in another secret treaty) guaranteed Spain that France would not make peace until Spain had regained Gibraltar from Britain.
In 1781, Britain decided they wanted to end the war (or at least the war with the Americans). They sent private messages to Benjamin Franklin (through Henry Laurens, an American envoy the British had captured) saying they were willing to talk. Franklin, Laurens, and Adams wanted to talk peace, but the French were not ready. They were engaged with Spain in the Great Siege of Gibraltar ( which was to last for 3 years 7 months, the longest siege ever endured by British troops).
France's reluctance to talk about peace led the wily Franklin to open secret talks with the British. Because the French were stalling (in hopes of winning Gibraltar for Spain) the British were keen to split the allies and make concessions to the Americans. Franklin got the British to concede the Mississippi as a western boundary, and the Northwest Territories (which Britain had transferred to Canada in "The Quebec Act of 1774". Adams (looking after Massachusetts interests) got the British to concede Grand Banks Cod fishing rights.
Spain, stalling the peace in order to try to capture Gibraltar, allowed the US to get much more out of the Peace than they had thought possible.
At the end of the day, Spain never did get Gibraltar. The battered and starving garrison fought off every attack. In 1782, the Royal Navy sent a re-supply convoy, protected by 33 battleships to break through to Gibraltar or die trying. The navy lured the French and Spanish ships away from the harbor, and the undetected convoy made a dash for it. Gibraltar was re supplied without a battle being fought, and France and Spain decided to throw in the towel and negotiate for peace.
By this time, the US had already agreed all of their terms with the British, and although Spain didn't like the US border on the Mississippi, and France didn't like the US fishing rights, it was too late for them to do anything about it.
So, in an indirect way, Spain's presence in the war proved very beneficial to the favorable US peace.