Basically I would like to know the historical context of the invention of the firearm. Was it originally meant for killing other humans? (i.e. military/protection from other humans) Or was it more geared toward hunting for food?
I'm going to copy and paste part of my answer to a more general firearms evolution question:
The very first "guns" of the 10th century were barely even meant to throw projectiles. Chinese fire-lances were tubes (initially bamboo, later iron) that were strapped to a spear. These were small tubes filled with gunpowder that would create a directed explosion toward a target, frightening and burning them. Since gunpowder was unknown by many peoples, even simple pyrotechnics like these and rockets could have quite an effect on people they didn't kill! It was as close as you could get to basically deploying magic on the battlefield.
Eventually they got the idea that this explosion could propel a projectile as well as it could fuel a rocket and began putting stones, arrows, and other objects in the tube. Then when the power of it was clear, they would remove the spear entirely and you now have the first true hand cannon. And of course, when you're done making something you'll inevitably hear "Why don't you make it bigger?"
Guns begin arriving in Europe somewhere around the 14th century, though nobody can confirm exactly when (was it Silk Road traders or invading Mongols who had encountered gunpowder during their conflicts with China?). It takes a very short period of time in historical terms before they start developing large cannons, which were used as early as 1346 at the Battle of Crecy. Smaller hand cannons were also developed and used around the same time, with both sizes now being used to fire single projectiles the diameter of the bore instead of basically being crude shotguns.
The next major development is in making the firing process easier. At this point you're just touching a slow match or other heat source to a hole at the breech to fire the gun, which means you have to tuck the gun under your arm, sit it on a rest of some kind, or have a second person fire while you aim. Around the 1440s-1450s you see the development of the matchlock, which is simply a piece of burning slow match held in a clamp. The other side of the clamp protrudes from the bottom of the stock, where pulling it backwards pivots the match down into a pan full of powder. With only a finger to fire the gun, you can now hold it on your shoulder and aim. Snapping matchlocks were quickly developed from this where the serpentine was spring-loaded to fire nearly instantaneously, but this often snuffed out the match and was mostly used for target guns.
From here the development continues into improved locks. Wheellock, flintlock, percussion cap, etc. before ending with the adoption of the metallic cartridge.