The hand cannon was simply a barrel attached to a handle, although there were many variations. Most drawings depict it with a wooden stake supporting the barrel, with a wooden stock in the back. It had no trigger; the powder was lit through a touch hole on top of the barrel by means of a smoldering piece of wood or coal, or slow-burning matches.
The version shown in the show appeared to be little more than a barrel mounted on the front of a thick plank, with a handle on the bottom that doubled as a war spike.
The Hand Cannon was based on the Siege Cannon: simply shrunk down to a more portable size.
Due to the primitive design; the Hand Cannon takes over a minute to reload (according to Deadliest Warrior). In comparison; the successor of the Hand Cannon (the Arquebus) can be loaded within 1 minute.
China invented gunpowder in the 800s and created various prototype weapons during the Song Dynasty. The most noticeable was the Firelance; a barrel that used gunpowder to launch fire or shrapnel (akin to shotgun shot) out of the tube. Created in the 900s and popularized in the 1100s; these proto-guns came in various experimental sizes and shapes. As seen with the Nest of Bees; these guns were more effective against thick armies as they lacked the precision to fight individuals. Fire lances normally contained enough gunpowder for one massive shot; but reloading was difficult during the heat of battle. Fire lances also had very wide barrels that did not focus the ammunition that was fired out of the barrel. 
The handcannon design would focus more on a single musketball as its ammunition; being mussel-loaded into a thin tight barrel to significantly reduce the ball from bouncing in the tube, thus maintaining a more precise forward movement. The smaller chamber also required less gunpowder (which could be carried in containers like bullhorns) and smaller musketballs; allowing foot soldiers to reload during a battle.
The Nayan Rebellion of 1287 is cited as the first major conflict using Hand Cannons (with the Chinese designed called the Huochong): however similar weapons did exist before this time period. The Heilongjiang Hand Cannon is an artifact believed to have been used in this same war. The 1320s and 1330s were the first reports of handcannons in Europe and by the late 1330s they gradually gained popularity throughout France. These guns most likely arrived in India and Arabia first: however (due to Mongol Conquests) historical documentation in these countries were pillaged along with accounts of Hand Cannons.
By the mid to late 14th Century; Handcannons spread across nearly all of EuroAsia and were called Hand Culverins. The French variation was called the Bâton à Feu.
During the Hussite Wars: Hussite Waggon-Forts made several successful stands against Catholic Knights; with the handcannons demonstrating its vital armor-penetration that stopped the heavy plate-armored soldiers.
The French use of handcannons were considered to be a major factor in their victory of the Hundred's Year War against the English: most noticeably the Battle of Castillon on 17 July 1453. John Talbot, Earl of Shrewsbury advanced his English army into the range of the defensive line of French handcannons and Siege Cannons. Talbot (unaware of the effectiveness of the musket) saw his forces get slaughtered by gunfire before making any gains in the battle. The penetration strength of French handcannons was rumored to be able to kill 6 men with each shot; regardless of their armor. The English suffered 4000 casualties while the French suffered only 100 casualties.
Vlad the Impaler used gunpowder effectively in the early 1460s to ambush Ottoman armies, being one of the first cases of gun use in guerrilla warfare.
Handcannons were initially denounced, especially by archers, who saw the weapon as sinful for being a peasant's weapon. Most archers trained since their youth, and so valued their skill and experience over a musketeer. Archers were estimated to fire 10 rounds a minute; even if this is considered an overestimation, bows still had a massive advantage in terms of rate of fire. Steel Crossbows and Handcannons had a similar rate of fire; but Crossbows had superior range and reliability. Handcannons were still easy to use for the common unskilled soldier and had excellent armor penetration.
The hand cannon was possibly the oldest portable firearm to be used in battle. Although inaccurate and slow to reload, it was more powerful than any other weapon of its time, piercing even plate armor. It also had a spike on if so it could be used in melee combat (being roughly the medieval equivalent of a bayonet). In Europe, it was used until the 1520's, when more advanced matchlock Arquebus firearms replaced it.
After the fall of the Mongolian Empire, the hand cannon evolved into the 3-Barrel Pole Cannon to increase the rate of fire.
It was tested against the Huo Chien. It was given the edge due to the fact it could actually kill and had melee capabilities, while the flaming arrow proved to be highly ineffective.