For women, they wanna keep the good stuff they get from their boyfriend or husband, but want some better or different sex. As for why not just try to work it out, that takes effort. And generally, women don't like to play teacher. They want the guy to know how to please her, already. And if a super hot alpha guy comes along and stimulates and excites her, while she's grown accustomed and bored with her husband/bf, it can make it tempting.
There's also an instinctual driver that makes it beneficial for her to stay with the bf/hubby while bearing a better man's child. He may be dedicated to her, while the other man may just have better traits to pass on.
For men, they just generally want to fuck 80% of the women on Earth. So, it's more a matter of giving into instinct. That desire doesn't leave when they fall in love, like it sometimes does with women. A guy will always want other women, on an instinctual level. The genetic programming to "spread the seed".
The dick has a brain of its own, which is separate from the guy's heart and mind. That's the best way to think of it.
You can't understand it, unless you've been in that situation. It's not a rational decision. It's temptation. It's an impulse thay has to be resisted. It's just weakness and selfishness. It's the animal nature we all have.
I have cheated before, and it was just heat of the moment. It was just too hard to resist.