Before there were guns there had to be something to make them fire. That explosive was black powder—a mixture of saltpetre, charcoal, and sulphur—which was probably used for fireworks by the Chinese as early as the tenth century. Black powder made its way to Arabia and then Europe in the early 14th century, where right away people began devising ways to use it for military purposes.
The Arabs had a bamboo and iron gun that shot projectiles. In Europe a possibly legendary German monk and alchemist named Berthold Schwarz is reputed to have made the first brass cannons. At any rate, by 1325 large guns were found throughout western Europe.
During the next 300 years gun technology made slow progress—smoothbore gun barrels and unpredictable powder made gunnery a haphazard affair, and more reliable and accurate weapons such as the longbow continued in use. Europe’s conservative outlook also made advances in any field sluggish.
Handguns came into being around the 1400s. These matchlock guns had a metal tube into which a round bullet and black powder were loaded. The user then lit an attached wick (“match”); pulling the trigger brought the match in contact with powder in an open pan. Around the same time, soldiers began shooting muskets, including the harquebus, a long matchlock that was so heavy it often needed a support structure. Early muskets weighed up to 40 pounds and measured six to seven feet in length.
In the 1500s the science of ballistics developed in Italy, and guns became a serious study. Rifling of gun barrels, to give projectiles spin and thus more accuracy, was attempted as early as the 1400s, but these efforts would not succeed until about 1655. Yet because of their convenience, muskets remained in use long after the appearance of accurate rifles.
In contemporary America, handguns require a license. Some states allow their purchase immediately, but others require a registration process with a waiting period. But nevertheless, you now have the most absurd situation where it is illegal to pull out a cigarette and smoke it but it is perfectably acceptable to walk around with a loaded gun.