In some fanfiction scenarios, it could be a matter of different ideals. Suppose there is a new movement in the wizarding world that Ron and Hermione believe in, but Harry opposes it. Their loyalty to this new ideology could be so strong that they see Harry as an obstacle and decide to betray him. It could also be that they are under the influence of a powerful and evil spell that warps their minds and makes them act against Harry without their full awareness.
Jealousy might be a motive. If Hermione is constantly outshining them in academics or getting more praise from teachers, they could become envious and turn against her.
Power could be a reason. If there's a chance for Ron and Hermione to gain a great deal of power by turning against Harry, some fanfictions might explore this. For instance, a new dark power might offer them something they've always desired, like the ability to reform the wizarding world in their own image. They might think Harry would oppose this, so they betray him to get what they want.
It could be due to a misunderstanding. Suppose Ron overhears a conversation between Harry and Hermione that he misinterprets completely. He might think they are plotting against him or don't really consider him a true friend. So in a fit of anger and hurt, he decides to betray them.
Well, in certain fanfiction scenarios, Ron's jealousy could be a factor. He might feel overshadowed by Harry for so long that it finally drives a wedge between them, and Hermione, being in a relationship with Ron, gets caught up in it. Another possibility is that a prophecy or some ancient magic forces them to make choices that seem like a betrayal to Harry, but they believe they are doing it for the greater good.
It could also be a result of some external influence, like a dark magic spell that has clouded Ron's judgment. This spell could be making him act against his normal character and do something as extreme as kidnapping Hermione. However, in the end, he would likely break free from this influence and realize the error of his ways.
Another motive might be related to a dark object influencing her. If Hermione came across a cursed object, like a dark locket that amplified negative emotions such as envy or fear, it could drive her to kill Harry. Maybe she started to envy Harry's fame and the special attention he always got, and the locket pushed her over the edge.
Hermione might seek revenge. Given her intelligence and magical abilities, she could use her skills to get back at Harry and Ron for their betrayal. This could lead to a big rift in their friendship and even endanger their common goals in the wizarding world. She might also side with other characters who are against Harry and Ron, changing the whole dynamic of the story.
Another motive could be a difference in ideology. If Percy believes in a different way of handling things compared to Artemis, and he feels that her methods are endangering the world or his loved ones, he might decide to betray her in order to stop her from following her current path.
One possible reason could be a misinterpretation of their relationships. Maybe the author wants to explore a different dynamic where Harry and Hermione bond over Ron's perceived flaws, like his occasional laziness or his insecurities that might come across as annoying to them in this fictional scenario.
It's possible that Harry hates it because he has a certain image of Ron and Hermione in his mind. Fanfiction can sometimes create versions of them that are completely different from what he knows. For example, some fanfiction might focus on a love triangle that he doesn't think exists in their real relationship. This divergence from his perception could lead to his dislike.