How did the War of 1812 start?
It’s a little complicated, but one has to understand that this is all taking place in the context of the Napoleonic Wars. There was near constant warfare in Europe for over a decade, and the struggle between Napoleon and Britain was going back and forth. So naturally, tensions had been rising between the US and Great Britain.
On one hand, the US wanted to remain neutral, but on the other hand, they felt more support for the French (as the French had helped them during the Revolution) and also felt that they could capitalize on the war in Europe by ensuring American hegemony North America.
Napoleon had instituted a blockade against Britain, and Britain in response started preventing ships from trading with France, including American ones. This combined with the British support of revolting Native Americans within US borders, and an American desire to expand into Canada inevitably led to war.
The war initially didn’t go so well for the US (Washington DC was burned down!), but eventually the US was able to withhold the British invasion and maintain their independence. This led to a distinct American sense of nationalism in the post-war years.