for some reason the S8 train is 5 minutes quicker.
That's because they take different routes. The S1 goes west, then around the west side of Munich to the airport, the S8 goes east and around the east side of Munich to the airport.
However, both S-Bahns don't leave the Hbf at the same time. The S8 leaves 12 minutes after the S1, so if you don't take the S1 and wait for the S8, you'll get to the airport later. If you take the next one leaving the Hbf for the airport, you'll get to the airport soonest.
The S-Bahn station at the Hbf is a two track station with the platform in the center and the two tracks, going opposite directions, are on either side of the platform. It's easy to stand on the platform and just take the next one going to the airport, as indicated by the sign on the front of the trains. There are also signs above each track showing the next few trains, when they are coming, and where they are going.
Take a little care when leaving from the Hbf. There are S1s and S8s in both directions. The S1 leaving from Platform (Gleis) 2 goes to the airport. The S1 leaving from Platform 1 goes to the east side of town (Leuchtenbergring). The S8 going to the airport leaves from Platform 1; the S8 leaving from Platform 2 goes to Herrsching, way to the SW of town.
The S8 is a little better because the S1 splits in Neufahrn, with the front end, I believe, going to Freising. You need to be on the back end (as I remember) to go to the airport. The entire S8 goes to the airport. If you don't take the S1 but wait for the S8, you'll get to the airport 7 minutes later, but you won't have to worry about the split in Neufahrn.