Perhaps in the fanfiction, James is seen as more accepting of Lily's friends and her social circle. Snape, on the other hand, might be associated with a darker crowd or have some beliefs that Lily doesn't agree with. For example, if Snape is too involved with the Dark Arts in the fanfiction, it could be a turn - off for Lily.
In many fanfictions, James is often written as having a more positive family background. His family could be portrayed as warm and loving, while Snape might come from a more troubled family. Lily might see a future with James as being more stable and happy, with a family that she could be a part of without much drama or hardship.
One reason could be jealousy. Snape might be jealous of James' popularity and charm. James, on the other hand, could be jealous of Snape's close friendship with Lily in their early years. Another reason is their different personalities. James was outgoing and bold, while Snape was more introverted and brooding. Lily might be attracted to different aspects of each of them, which could lead to the fight as they both compete for her attention.
It could make Snape more bitter. Since he lost Lily to James, he might become even more withdrawn and focused on his own studies or other solitary pursuits. This could further isolate him from others and fuel his resentment towards James and his group.
Perhaps they are blackmailed. A powerful dark wizard could threaten to harm all of their friends and family if they don't abandon Harry. They may feel they have no choice but to sacrifice their relationship with their son to protect others they care about.
It could also be due to some external factors. Maybe there are threats from dark forces that he doesn't want to involve Lily in. If he is getting deeper into the dark arts or some dangerous situations, he might choose to give up on her to protect her from the potential harm that could come her way because of his associations.
One reason could be jealousy. Maybe Snape gets jealous of Lily's other relationships or her popularity at Hogwarts. Another could be a fundamental difference in their beliefs or values that grows over time into hatred.
It could be that in fanfiction, Snape has been through some additional trauma or experiences that change his perception of Lily. For instance, if he discovers something about Lily that he doesn't like, such as her involvement in some secret or her having a different side to her character that he finds unappealing. This would cause him to dislike her, as opposed to his more nuanced feelings in the original story.
One reason could be jealousy. If in the fanfiction Snape is getting more attention or praise from the wizarding world than Lily, she might start to dislike him. Another reason could be that Snape has a different view on blood purity, and Lily strongly disagrees with him, which leads to her hatred.
Perhaps Snape believes that James has some crucial information that he needs and he thinks torture is the quickest way to get it. Or maybe there's a power struggle going on. Snape wants to assert his dominance over James, who might be seen as a rival in some way, either for a position at Hogwarts or in the wizarding community. Also, it could be due to a misunderstanding that has spiraled out of control, leading Snape to think that James is a greater threat than he actually is.
In some fanfictions, it could be related to Lily. If James did something that Snape perceived as a threat to his relationship with Lily, even if it was just being overly affectionate with her in front of Snape, Snape might lash out at James. Snape had deep feelings for Lily, and any sign of James getting in the way could trigger an attack.
In the fanfiction, perhaps differences in their future plans might lead to divorce. Maybe James wants to move to another city for a job opportunity, but Lily doesn't want to leave her family and friends behind. So, this fundamental difference can drive them apart.