It was established legal tradition in Britain for some time before the US war for independence that people were allowed to own guns because, even though hunting was illegal, guns weren't only for hunting, they could be used to defend one's home. It was common in the colonies (where everyone had guns, and hunting was legal) that every man was required to bring his gun to church on Sunday, in case a group of men with guns was required for any purpose. These guns were expected to be serviceable military weapons - a tradition going back to the late medieval period, where every man was required to own a weapon of war in case that was needed (and swords were very cheaply available after the plague, so real military weapons, not farm implements, were expected).
There are still several modern nations in which every man of age is required to own a modern military rifle (issued by the government). This idea that somehow the "right to keep and bear arms" excludes modern military small arms is a very modern contrivance, and not at all the intent of the Second Amendment. Heck, not just small arms - even 100 years ago cannon were typically bought for the town by the wealthy, and taken off to war when needed.
It's a very simple idea with centuries of legal tradition behind it: a free man has the right to own a gun, and not just for hunting, but actual military small arms. Totalitarian states disarm their subjects to prevent uprisings. Free societies have an armed populace to keep the government nervous about uprisings. It really is that fundamental.