ar 15 (thats the m16 to you): the hammer strikes the firing pin, which strikes the primer at the back of the cartridge. the primer ignites the powder charge which causes an explosion of hot gases to propel the bullet down the barrel.
the AR uses a direct impingment (DI) system, gas is siphoned off through the front sight base (that little triangle looking thing at the front that has the sights in it) as the bullet passes the gas port. the gas is tapped from the port to the gas tube, which runs the top length of the handguard into the upper reciever where it meets the bolt carrier (BC) key. the gases are funneled into the BC, pushing the BC backwards towards the buttstock. as this happens, the bolt cam pin causes the bolt to rotate, unlocking itself from the barrel and the bolt continues moving to the rear with the BC.
this motion extracts the shell from the chamber and the bolt's extractor ejects it from the side of the upper reciever. the buffer spring inside the buffer tube that is in the buttstock then pushes the BC forward, stripping a new round off the magazine and feeding it into the chamber as it passes. finally the bolt cam pin twistes into a pocket milled into the upper reciever that allows the bolts locking lugs to rotate and lock into the barrel.
AK47: the hammer strikes the firing pin, which strikes the primer at the back of the cartridge. the primer ignites the powder charge which causes an explosion of hot gases to propel the bullet down the barrel.
the AK uses a long stroke gas system. gas is tapped off through the gas port ( the tube above the barrel) and into the gas tube where it meets the gas piston that is attached to the BC. the piston moves backwards with the BC, causing the bolt to unlock and move backwards also. the shell is removed from the chamber and the bolt's extractor ejects the spent shell out the side of the reciever.
the recoil spring then pushes the BC forward, stripping a new round from the magazine, the feedramp feeds it into the chamber, and the bolt locks into place.