A few reasons- not all relevant for all cheaters.
Because the image he has of himself doesn’t match the real him. ‘I’m a good guy’.
Because they compartmentalise.
Because the cognitive dissonance they experience requires them to justify it - it’s nothing, s/he doesn’t like me anyway, s/he is cheating on me, I was just looking, it means nothing.
It is also a control problem, they like to remain in control. If they told you the truth and allowed you to make an informed decision then YOU might decide to leave. By controlling the narrative they get to decide.
Because they feel they deserve more than the 80% a normal relationship provides. He need smoke up his arse or ego kibbles. He can’t self soothe or entertain himself. Etc etc.
Because they are proven liars. It’s a poor character trait. They are okay with lying, to themselves, to others. Lies are okay.
They only believe in fidelity to a point. They have a but in their belief system - I believe in fidelity but not if it’s on a lads night out. I believe in fidelity but not if I definitely won’t be caught. I believe in fidelity but it doesn’t count if it’s my ex.
No kids, No marriage, no mortgage together - run like the wind. He’s done you a huge favour as the poor character traits that allow him to cheat are the same traits that make reconciliation nigh on impossible. You don’t want kids with this bad egg.