Another reason could be power. Harry might have been lured by the idea of greater power on the dark side. He had faced so many challenges and losses on the 'good' side, and the dark side could have promised him the ability to change things in a more decisive way, like being able to prevent the deaths of his loved ones.
Perhaps he was deceived. There might be a powerful dark wizard who managed to convince Harry that the dark side had a more 'just' cause. This wizard could have used false information about the history of the wizarding world and how the dark side was initially misjudged.
The Ministry of Magic could be the ones to betray Harry. They might try to use Harry as a pawn in their political games, and when Harry realizes this, he loses faith in the so - called good side. Voldemort then takes advantage of Harry's disillusionment and convinces him to join.
Hermione could be the one. Maybe she gets jealous of Harry's fame and power, and starts spreading lies about him, which leads to his betrayal. As a result, Harry feels so hurt that he turns to Voldemort.
In 'harry potter is betrayed fanfic', Luna Lovegood might be a character who betrays Harry. Maybe she is under the control of some mind - altering spell or has been deceived by a false prophecy that makes her think she is doing the right thing by betraying him. Also, Hagrid could be a shock betrayer if he is somehow forced to choose between Harry and his beloved magical creatures, and chooses the latter in a way that is seen as a betrayal to Harry.
It completely flips it. Instead of being the hero we know, he becomes a figure of fear and suspicion. His actions would shock those who knew him, as he was always seen as the one to fight against the dark, not join it.
One possible reason could be jealousy. If Harry gets more attention or power than the Weasleys, they might feel envious and turn against him.
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.
In some fanfictions, Ginny might be written to betray Harry because of a prophecy. The prophecy could mislead her into thinking that Harry was going to bring doom, and so she decides to act against him to prevent that. It's a different way of looking at their relationship compared to the original story, where their bond was based on love and trust.
Even Ginny could be written as a betrayer in a fanfic. For example, if she becomes possessed by a dark force, she might turn against Harry. Her relationship with Harry is so central in the original story that a betrayal from her would be a huge shock and create a lot of drama in the fanfic.
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.
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.