Fire is produced in the firebox which burns wood, coal or oil. Hot gases released by the combustion enter tubes in the boiler. The water in the boiler is heated at the hottest location, on and around the firebox, and produces steam. The steam pressure builds in the boiler as the water expands and is then released into the cylinders to move the pistons. The back-and-forth movement of the pistons moves the rods that turn the wheels. The exhaust steam from the cylinders goes up the blast pipe and joins with the smoke from the fire to go up the smokestack. That is when we see the big puff, and hear the swhooooosh.
What happens inside the steam boiler.