One possible reason could be jealousy. Maybe his friends are jealous of Sonic's speed or his heroic status. Another reason might be a misunderstanding. For example, Sonic could be framed for something he didn't do, and his friends believe the false evidence. It could also be due to outside influence, like an enemy manipulating his friends' minds into thinking Sonic is a threat.
Sonic usually feels a great deal of shock and confusion at first. He can't believe that his friends would turn on him. Then he might feel anger, especially if he discovers that they were misled or acting out of unjust reasons.
Naruto's power might also be affected. If he was betrayed, he could lose the will to fight or train. He might even start to doubt his own purpose. This could lead to a decline in his abilities, which in turn could put the village at risk if he was its main protector.
In such a fanfiction, perhaps Harry's friends are jealous of his newfound powers or popularity within the wizarding world. So they spread rumors about him being untrustworthy. As a result, Harry is shunned by many in the community. He has to embark on a solo journey to prove his innocence and in the process discovers who his true friends really are.
In a fanfiction where Naruto is betrayed by his friends, it could start with jealousy. Suppose Naruto gets a great power or a special recognition. His friends, feeling overshadowed, might be tricked by an evil force into thinking Naruto is using them. So they betray him, which makes Naruto realize that he has to rely on his own strength and find new allies who truly understand him.
Sometimes in fanfictions, character development takes a dark turn. The friends might have their own personal goals that conflict with Naruto's. They could see Naruto as an obstacle to achieving those goals. Or perhaps there was a long - hidden secret that came to light, which made them change their attitude towards Naruto, leading to the so - called betrayal.
The Ministry of Magic could also be the main antagonist in this case. If the Ministry is corrupted or under the influence of dark forces, they could manipulate Harry's friends. They might convince his friends that Harry is a danger to the wizarding world order, and his friends, being naive or misinformed, end up betraying him.
Sonic would probably be very shocked at first. He trusts Amy, so her betrayal would be unexpected. He might initially try to talk to her to understand why she did it.
The story could go like this. Percy's friends are influenced by a false rumor about him. They start to avoid him and eventually turn on him. Percy, who has always been loyal to them, is devastated. He has to figure out how to clear his name while also dealing with the pain of their betrayal. Along the way, he might meet new allies who help him through this difficult time and show him that not all people are like his former friends.