Gun barrel
Overview
 

A gun barrel is the tube, usually metal
Metal
A metal , is an element, compound, or alloy that is a good conductor of both electricity and heat. Metals are usually malleable and shiny, that is they reflect most of incident light...

, through which a controlled explosion
Explosion
An explosion is a rapid increase in volume and release of energy in an extreme manner, usually with the generation of high temperatures and the release of gases. An explosion creates a shock wave. If the shock wave is a supersonic detonation, then the source of the blast is called a "high explosive"...

 or rapid expansion of gases are released in order to propel a projectile
Projectile
A projectile is any object projected into space by the exertion of a force. Although a thrown baseball is technically a projectile too, the term more commonly refers to a weapon....

 out of the end at a high velocity.

The first guns were made in a time where metallurgy
Metallurgy
Metallurgy is a domain of materials science that studies the physical and chemical behavior of metallic elements, their intermetallic compounds, and their mixtures, which are called alloys. It is also the technology of metals: the way in which science is applied to their practical use...

 was not advanced enough to cast tubes able to withstand the explosive forces of early cannon
Cannon
A cannon is any piece of artillery that uses gunpowder or other usually explosive-based propellents to launch a projectile. Cannon vary in caliber, range, mobility, rate of fire, angle of fire, and firepower; different forms of cannon combine and balance these attributes in varying degrees,...

, so the pipe (often actually built from staves of metal) needed to be braced periodically along its length, producing an appearance somewhat reminiscent of a storage barrel.

Another explanation, tied to etymology
Etymology
Etymology is the study of the history of words, their origins, and how their form and meaning have changed over time.For languages with a long written history, etymologists make use of texts in these languages and texts about the languages to gather knowledge about how words were used during...

, states that many very first firearms barrels were in fact realized, during the 12th and 13th centuries, using small storage barrels with their usual metal rings reinforced by leather, hence the barrel name.
 
x
OK