He doesn't feel desired anymore
This may sound odd, but guys need to feel sexy too. We need to know you want us, sexually. There's companionship, which is great, and we love cuddling next to you too, honey, but we need to know that at the end of the party you are counting down the minutes until you can rip off our shirt. If a guy isn't feeling like you're into sex with him he's going to be more prone to the attention of someone who does. Another way of saying this is that the guy wants to know he's still got it. He needs to validate his manhood.
You're not having enough sex
To take this a bit further, not only is he not feeling desired, he feels like his needs aren't being met in the bedroom. He's tried initiating sex at all sorts of times, only to find you more interested in a good book. Before, you two used to be hot and heavy everywhere, now sex seems to be a once a week affair, max. He is tired of having sex on his own in the shower, he sees an attractive co-worker who clearly expresses interest, and it goes from there. This is the sort of thing where he may still feel satisfied in other areas of the relationship but not the bedroom.
He knows there's no future with you
This is the main one. The guy figures out that you're not the one he's going to settle down with but at the same time nothing is necessarily wrong with the relationship. Maybe you've been fighting a bit but you still love each other. It's very confusing because on one hand things are okay, on the other he knows he needs to end it. So what does he do? He cheats. Then things get a bit clearer and there's a reason to break up.
He got way too drunk and is an idiot
You don't want to hear this but there are times when a guy is hanging out with a group of dudes, they're drunk, and within that group of dudes cheating is not the worst of all evils, so no one will say anything. At that moment a beautiful, out-of-his-league girl hits on him and the thought of this sort of girl may never come my way again arises. All those factors combine into a perfect storm and the guy drunkenly ends up in bed having horrible sex (because he's drunk) and wakes up feeling like a complete idiot. He didn't want to cheat but his mental capacity no longer exceeded the bar he was at and thus you were not on his mind.
We all know that people shouldn't cheat. Now, you could sit there and think, "If I had done that differently, then he wouldn't have cheated." More often than not, people cheat for several reasons. It's a long buildup of a combination of things including feeling unheard, dissatisfied, and not desired. It's negative external influences like friends with loose morals and drugs and alcohol. The bottom line is that the best way to avoid your guy cheating is by doing everything for him that you expect him to do for you. Maintain open lines of communication, particularly around what you both feel a healthy relationship and sex life should consist of. At the end of the day, if he cherishes you too, he won't cheat.