One possible reason could be a misunderstanding. Maybe there was a miscommunication between Hermione and her friends, which led to them leaving her in the fanfiction. For example, if Hermione made a decision without consulting them, they might feel left out and decide to leave.
It could be a matter of loyalty being tested. If Hermione is accused of something she didn't do, and her friends don't believe in her innocence right away, they might leave her. In fanfiction, the author might be exploring the idea of how fragile friendships can be. Her friends could also leave if they feel that Hermione has changed too much, for example, if she becomes too strict or too obsessed with a particular project or cause.
One reason could be jealousy. Maybe her friends get jealous of Hermione's intelligence or achievements and act mean towards her in the fanfiction. For example, they might exclude her from certain activities or make snide remarks about her grades.
One reason could be jealousy. Maybe Hermione has achieved something great in the fanfiction, like getting a top grade in a really difficult subject, and her friends are envious. Another reason might be a misunderstanding. For example, if she's been spending a lot of time with a new character, her friends could misinterpret it as her neglecting them.
One possible reason could be a misunderstanding. Maybe her friends thought she was following but she got distracted by something, like a new spell she saw in an old book. So they unknowingly left her behind.
One reason could be to search for a powerful magical artifact outside of Hogwarts that they believe is crucial for defeating a new dark threat. In fanfiction, they might feel that Hogwarts has become too dangerous or restricted in terms of resources for their mission.
One reason could be the media attention. After all they've been through, they might be tired of constantly being in the spotlight. The British wizarding press could be hounding them, so they leave to get some privacy.
One possible reason could be jealousy. Maybe her friends are envious of Hermione's intelligence and magical abilities. In a fanfiction, this could lead them to betray her to gain an advantage or to make themselves look better. Another reason might be a misunderstanding. A miscommunication or false assumption could cause her friends to turn against her.
She might be initially shocked. After all, she would have trusted her friends a great deal. Then she could become very sad and withdrawn. She might throw herself into her studies even more as a way to cope, trying to distract herself from the pain of losing her friends.
She might be initially shocked and hurt. Hermione is a character who values her friendships deeply, so their sudden departure would be a big blow. She could spend some time in denial, not believing that they would actually leave her.
One reason could be to seek greater power. In fanfiction, the world outside Konoha might be seen as having more opportunities for growth. They might want to train with different masters or learn unique jutsu not available in Konoha.