There are a few different types of gun magazines, but all of them work the same way.
The bullets are held in a spring-loaded magazine that is inserted into the gun. When you pull the trigger, the hammer strikes a firing pin, which causes a spark to ignite the powder in the cartridge. The expanding gases from the burning powder propel the bullet out of the barrel and downrange. As soon as the bullet clears the barrel, a new round is automatically loaded from the magazine into place and ready to fire.
Mike Edited answer August 31, 2022