In some fanfics, it could be related to a prophecy. The Weaslys might think that Harry is going to bring doom in the future according to a misinterpreted prophecy, and so they betray him to try and prevent that. Or perhaps there is an outside force, like a powerful dark wizard who manipulates the Weaslys into betraying Harry by threatening their family or offering them something they desperately want.
One possible reason could be jealousy. Maybe the Weaslys in the fanfic become jealous of Harry's fame or special abilities. Another reason might be some kind of dark magic influence on them, which changes their nature and makes them turn against Harry. It could also be due to a misunderstanding. For example, a false rumor spreads about Harry that makes the Weaslys believe he has done something terrible.
Harry might be initially shocked and heartbroken. He trusted the Weaslys like family, so the betrayal would hit him hard. He could become more withdrawn and distrustful of others.
One possible reason could be a misunderstanding over a spell or a magical object. Maybe Hermione thought Harry was using a dangerous or unethical spell, and they got into an argument that turned into a fight. Another reason might be related to their different approaches to solving a problem at Hogwarts. For example, Harry might be more impulsive while Hermione wants to follow the rules strictly.
In some fanfics, it might be for the sake of a more complex plot. The writer wants to create drama and conflict. So, Ginny could be made to betray Harry to add a new layer of struggle to Harry's life. It could also be related to her family loyalty. If the Weasley family was somehow forced into a difficult situation where they had to choose between Harry and their own safety, Ginny might be written to make a choice that seems like a betrayal to Harry.
One possible reason could be jealousy. Maybe his friends become envious of Harry's growing powers or popularity. For example, if Harry is suddenly getting all the attention in their magical community, his friends might feel left out and start to resent him, leading to betrayal.
One possible reason could be jealousy. Naruto is very powerful and some in Konoha might be envious. For example, some minor clans might feel that Naruto, as an outsider in a sense, gets too much attention and resources. Another reason could be fear. His Nine - Tails power is so immense that some might fear he could lose control and endanger the village, so they betray him to try and eliminate the 'threat' before it's too late.
In some fanfictions, it could be due to a long - hidden family secret. His parents might have had a past that they were ashamed of or a debt they had to pay, and unfortunately, Harry became a part of that repayment which led to the perception of betrayal. They could have made a deal with a dark force before Harry was born, not realizing the full implications it would have on their son.
In the '4 kunoichi gets betrayed fanfic', it could be that the four kunoichi are working for a noble cause. However, one of their own, due to jealousy of the attention the others get, decides to betray them. She spreads false rumors about them, making the whole ninja community turn against them. The four kunoichi have to prove their innocence and also figure out a way to deal with the traitor within their group.
Maybe they were forced into it by some dark magic or a powerful dark wizard. They could have been blackmailed into betraying Harry to save their own lives or the lives of others they cared about.
In some 'harry gets betrayed fanfic', it could be Dumbledore who betrays Harry in a way. Maybe Dumbledore has been using Harry all along for a greater plan without fully disclosing it to him. Harry would feel extremely hurt and betrayed as Dumbledore was like a mentor to him. This would lead to a series of events where Harry questions everything he has known and tries to find his own path.
One possible reason could be a misunderstanding. Maybe some dark magic was involved that made Harry believe the Weasleys were acting against him or the wizarding world in a way that seemed illegal. For example, if there was a spell that distorted his perception of their actions.