As I understand it, the early American government wanted an armed populace as a check against the power of government. Though realistically, having everyone armed also makes it difficult for a foreign power to invade. The Patriot leaders distrusted standing armies, so instead the defence of the nation would depend on militias. This is outlined in the 2nd amendment, which was drafted two years after the Continental Army demobilized.
Over time, guns have become baked into American culture. Though today, I think a large part of the gun culture stems from the state's inability to deal with lingering problems in society. The amendment has long been controversial among some scholars (according to my brief research), but popular debate didn't kick off until the second half of the 20th century.
I think the roots of the current debate can be traced back to the civil rights movement, growth of urban decay, and the rise of innercity violence in the 1960s. Of course then there were the high profile race riots like Watts in 1965. I think this scared a lot of the white, middle class. Which is what I think prompted a lot of them to arm themselves. Unfortunately I couldn't find statistics prior to 1973. Though whites do own the most guns as a percentage of their total population. It's no surprise that gun ownership peaked in the 1970s, during a very tough political and economic time for the US. Also when innercity violence was starting to kick into high gear.
The anti-gun side tends to miss the boat on tackling the root causes of crime, and simply wants to ban the method. Something that rarely seems to come up in the debate. It gets passing mention but no solutions are ever offered.