Perhaps it's a new character introduced in the fanfiction. This new character might be from a different dimension or planet and has a hidden agenda. They see Goku and Gohan as threats to their plan, so they manipulate the people around Goku and Gohan to turn against them.
It could be Vegeta. Maybe in this fanfiction, his pride gets the better of him and he feels overshadowed by Goku and Gohan's power. So he fabricates some lies to make them look like traitors to the rest of the group.
Another possibility is that it could be one of the minor characters who has been secretly envious of Goku and Gohan all along. This character could have found an opportunity to make them look bad, like by doctoring some videos or audio recordings to show them 'collaborating' with the enemy, thus making everyone believe they have been betrayed.
It could be his friend, like Mitsuki. Mitsuki has his own secrets and goals, and in some fanfiction, he might be forced to betray Boruto for the sake of some greater good in his mind. For instance, if he has to choose between following Orochimaru's orders and staying loyal to Boruto.
In some versions, it could be an evil version of one of Tails' friends. Maybe through some dark magic or experiment gone wrong, Sonic or another friend turns against Tails. Their altered state makes them see Tails as an enemy, and they start to undermine him and try to harm him, which would be a huge betrayal for Tails.
In the 'goku and gohan betrayed fanfiction', perhaps they are betrayed due to a misunderstanding. Say, Goku makes a deal with an unknown force to save the universe, but it's misconstrued as him allying with the enemy. Gohan, being associated with Goku, is also seen as a traitor. And this misunderstanding could be spread by a character with their own motives, like a power - hungry individual who wants to take over the Z - fighters' leadership.
It could be a jealous demigod. Maybe someone who is envious of Percy's popularity and Nico's unique powers. This person might see an opportunity to get rid of them and take their place in the demigod hierarchy.
It could be Valerie. She has had a somewhat rocky relationship with Danny in the original series. In a fanfiction about betrayal, she might be pushed over the edge by jealousy or a misunderstanding about Danny's powers and his intentions. She could then use her ghost - hunting skills against Danny in a more malicious way than before.
A new character could be introduced as the betrayer. This character could be a fellow robot created by the same technology as Mega Man but with a corrupted program. This character could pretend to be on Mega Man's side, gain his trust, and then stab him in the back when he least expects it.
It could be Sakura. Maybe she becomes envious of Naruto's newfound godlike status. She might feel that he has changed too much and is no longer the Naruto she knew. So, she could side with those who want to bring Naruto down, either out of jealousy or a misguided sense of what's right for the village.
A love interest is also a common choice. In fanfictions, love can be a complicated and often treacherous thing. The love interest could have their own motives, like being forced by an external power or having a hidden agenda that conflicts with Fem Robin's goals.
Another possibility is that it could be a character who has been corrupted by dark magic. This character was once a friend or at least an acquaintance of the dragon rider. But the dark magic makes them see the dragon rider as a target. They betray the rider in the hopes of getting some sort of power or reward from a more powerful evil entity.
One likely betrayer could be Serena. Maybe she has some hidden motives that are revealed when Ash becomes champion. For example, she might be jealous of his success and the attention he gets as champion, and so she betrays him.