Most people believe that cheating in a relationship is bad. At the same time, it's common enough to be a trope in virtually every romantic comedy you've ever seen. This video explains some of the reasons why this dichotomy exists. As the video above from lifestyle site Bustle explains, there are multiple explanations behind the impulse to cheat in otherwise committed partners. There's the fact that humans are not naturally inclined to monogamy. Though, as the video points out, we're not naturally inclined to play the violin, either. Not everything that comes naturally is beneficial.
There are also structural and chemical conditions in the brain that may make someone more likely to cheat. Those more prone to thrill seeking may find it harder to control the impulse to cheat. There are also multiple ways we connect to other people in the brain, but these may not always be aligned with a single person.
Of course, having a scientific basis for why someone might believe cheating is bad yet do it anyway doesn't necessarily excuse the behaviour. Science doesn't provide moral arguments one way or another. However, it's helpful to understand how our brains and bodies work when deciding those things.