A "gun" works by channelling the explosive force of a propellant down a barrel, driving a projectile ("bullet") out of the barrel and towards a target.
How A Gun Works
The same forces are at work, whether using an antique muzzle-loader or a modern-day rifle or pistol.
Modern ammunition carries the primer, propellant, and projectile all in the same cartridge. The process of firing the gun starts when you load the cartridge into the firing chamber. After loading the cartridge, you aim the weapon and pull the trigger. The mechanics of it may vary, but a firing pin eventually strikes the primer, which ignites the propellant. The hot explosive gases are channeled behind the projectile, forcing it down the barrel and out of it.
There are many variations of "guns," such as single-shot, revolver, and semi-automatic. Here's an excellent Wikipedia page describing various types of handguns and the differences between them Click Here