It's called a backfire or misfire. It's generally caused when all the gas doesn't burn in the cylinder head like it's suppose to. Then it exploded in the exhaust system.
Edited to add: movieman beat me posting by a few seconds. We're saying the same thing.