I think the OP is asking a question of “how” it happens. An understanding of the circumstances that “fertilized” the environment that made a person susceptible to an affair. The OP isn’t trying to justify or excuse the affair. Just get an explanation.
Personally, I think such a discussion can be helpful. It is like studying history (provides knowledge to prevent it from repeating). Let me give you an example.
My wife and I had a couple as friends. Separately, we each enjoyed the relationship with our respective same gender friend. But when we were together, we saw that there was a poison between them. And we both determined that the wife was the source of most of the poison. Because of her own upbringing, she was overly selfish or said in another way insufficiently present to her husband. She belittled him, his income, avoided the marital embrace and criticized his expenditures not because they were excessive but because it lessened her capacity to spend on herself.
When I found out that he turned to another for affection, we were both appalled. And, my wife’s reaction was especially condemning of the husband. But as we talked it through, we realized that despite the magnitude and wrongness of his “solution” that the seeds were planted by the wife and “fertilized” by the wife because she didn’t fulfill her obligation as a wife to love her husband more than herself. We both acknowledged that for the bulk of the marriage he had been significantly more giving and understanding.
The lesson here is what the Church teaches about how a life of venial sins can so damage the soul that they become in effect mortal. The acts (and non-acts) of the wife were mortally wounding the marriage long before the husband committed his wound.
And once, we realized jointly that they were both at fault equally for the affair we could then properly be instruments of the Holy Spirit to get them both to look at their actions as sinful and need of reparation. Instead of my wife taking her side and me his side, we both “took” the other’s side. I gave the husband no comfort and made him see how he had been even worse to her than her own family growing up being the rock of trust she needed. My wife always focused on what her friend did to her husband since the beginning of their marriage and she refused to criticize the husband.
There is a happy end to the story. Ultimately, they stayed together and got both spiritual and professional counseling. Their pastor (they are not Catholic) was great as he counseled them that they had to first get right with God before they could get right with each other (IMO, the Sacrament of Penance would have helped immensely and speeded up their ultimate reconciliation).
While it still isn’t a perfect marriage (which one is?), she is more aware of how she affects her husband, he is more aware of how her background affects her behaviour, they have non-threatening cues that remind the other that understanding and charity is needed, and he has been “armed” with tools that prevent him from falling into despair.
To our benefit (my wife and mine), we now have even better friendship with them and enjoy more time with them as a couple.