Let's just look at one piston. It's traveling downward, causing a vacuum as it moves down. The intake value is open, pulling in an air fuel mixture. When it hits the bottom, the intake valve closes. As the piston travels up, the air fuel mix is compressed, when it gets to the top, the spark plug fires and the mix is ignited, the resulting explosion sends the piston down. At the bottom, the exhaust valve opens, and as it come back to the top exhaust gasses are sent out.
For a more intense look, see the link below.