It's also useful to know what "well regulated" and "militia" meant in the context of the time this was written. The "militia" was every able bodied male above a certain age. "Well regulated" meant properly functioning.
There is no "debate" about why the 2nd Amendment was written. It was written largely as a response to the attempt by the British to seize the weapons of the colonists leading up to the Revolution. There are the facts and there are ignorant people or those pretending to be for their own political purposes.