There is a wide variety of reasons but most often it has to do with "immaturity" and trying to "have it all".
A mature person eventually realizes there is no one person who is going to have "everything" they could ever want in mate. At some point one has to prioritize their "requirements" and decide which are the "most important" and then let go of the rest.
The goal of a cheater is to (hold onto) all that is "good" in their primary relationship while they address their other "needs" on the side. Most cheaters aren't looking to (replace) one relationship with another and they have no desire to go through a breakup/divorce.
There are 3 basic cheaters:
"The Incessant Cheater" - Gets bored easily/believes variety is the spice of life. They most likely have NEVER been faithful in any long-term relationship. Whenever they attempt to have a monogamous relationship it's like going on a super "strict diet". The "cravings" never leave them. Monogamy is against their nature.
"The Unbelievable Opportunity Cheater" - This is someone who does not pursue cheating opportunities. Maybe they've had a fantasy/crush on someone, or they're on a business trip with someone they consider to be "hot", seductively famous, or powerful and this person hits on them or makes themselves available for a night. They can't believe their "luck"! Odds are the cheater's mate will never find out and they (cave into temptation) to live out their fantasy.
It's not uncommon for this type of cheater to feel an immense sense of guilt afterwards when they look into their mates loving eyes. Many have confessed to cheating days, weeks, months, or years later to remove the guilt off of their shoulders,
The Discontented Cheater - They see their actions/cheating as a "reaction" to what their mate is doing or not doing. In their mind they would never have cheated if their mate was (romantic/passionately having sex, making them feel "special", or accepting them for who they are instead of trying to change them.) This cheater "justifies" their actions to eliminate feelings of guilt.
Whenever a cheater gets caught and is asked (why) they're most likely going to claim to belong to the "discontented cheater group". It's the only option that might elicit sympathy/forgiveness if the betrayed person remotely (believes) they "contributed" to the reasons that led their mate to cheat.