One reason could be that James is simply not ready to be a father. He may be afraid of the responsibilities that come with having a child and decides to run away from them.
It's also possible that James has some personal issues or problems that he doesn't want to burden Lily with. However, his way of dealing with it by leaving is clearly not the right one. He could be dealing with family pressure, financial troubles, or his own insecurities that make him feel he can't be there for Lily and the baby.
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.
Well, one possible plot could be that they face a lot of challenges. Their friends might be shocked at first. They'd have to deal with their studies while also preparing for a baby. And they might worry about how the Hogwarts faculty would react, whether they'd be allowed to stay in school.
One possible reason could be that he realizes his feelings are unrequited. In the fanfiction, perhaps Lily has made it clear she doesn't have the same feelings for James, so he gives up. Another reason might be external factors. For example, there could be some sort of danger or situation that makes James think he needs to step back from Lily for her own good.
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.
One possible reason could be a plot device to create drama. Maybe the author wants to show a rift between them for the sake of a more complex storyline. For example, if there's some misunderstanding or a secret that has come to light which makes Harry act this way.
Voldemort and his Death Eaters could be the main antagonists. Since they are against the wizarding world's light side, they would see Lily and James's unborn child as a threat, especially if there are prophecies surrounding the baby.
One possible reason could be that Naruto has a dangerous mission that only he can undertake. The safety of the village or the greater good might demand his immediate departure, even though it's hard for him to leave Hinata in such a state.
One possible reason could be an alternate universe scenario. Maybe in that fanfic's universe, there are dark forces at play that make Lily and James act out of character and ignore Harry. It could also be a plot device to create a more angsty or dramatic story, where Harry has to face challenges without the support of his parents.
One possible reason could be to escape the danger in England. Given the dark forces that were at play, especially Voldemort's rise, they might have felt it was safer to leave. Another reason could be for a fresh start. Maybe they wanted to explore new magical cultures and communities in other parts of the world.
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.