Well, it could be due to the stress of the wizarding world's constant threats. For example, if a character has witnessed a lot of dark magic attacks like the Death Eaters' raids. It can leave them psychologically 'not ok'.
One way could be through the power of friendship. Just as Harry, Ron and Hermione supported each other in the original books. In the fanfic, other characters could come together to offer emotional support to the 'not ok' character.
The 'I'm not OK' fanfic might be unique because it can offer different perspectives on the original concept. It allows fans to explore the characters' emotions and situations more deeply.
In fanfic, one reason could be that he might feel constantly in danger at Hogwarts. With all the dark forces targeting him, he could think running away is the only way to keep his friends safe. For example, if Voldemort's followers keep infiltrating the school, Harry might feel responsible and decide to leave to draw the danger away from others.
He might leave Hogwarts in fanfic due to a sense of disillusionment. Maybe he discovers some dark secrets about the school or the wizarding world in general that make him question his place there. It could be something related to the way the school is run or a conspiracy among the teachers that he stumbles upon.
Perhaps in this fanfic, there has been some major plot twist that makes Harry believe that bowing to Voldemort is the only way to save his friends or the wizarding world. For example, Voldemort may have threatened to kill all of Harry's loved ones if he doesn't submit, and Harry is sacrificing his pride for the greater good.
He might hide it because he doesn't fully understand his own fascination. Harry has always been on the side of good, but perhaps there are elements of the dark side that seem alluring in a strange way. He could be afraid that exploring these feelings would lead him down a dangerous path, so he keeps it a secret.
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 a misunderstanding. Maybe Harry is led to believe that Dumbledore has been hiding something crucial about his parents' death or Voldemort's return. For example, if Harry discovers some encrypted files in Dumbledore's office that seem to suggest Dumbledore had a prior deal with Voldemort, it could lead to a fight. Another aspect could be related to power. If Harry feels that Dumbledore is being too controlling over his actions and the use of his powers, he might lash out. In the wizarding world, power struggles are not uncommon, and Harry, as a powerful wizard in his own right, might want to assert his independence.
One possible reason could be a misinterpretation of his character. In the original series, Harry Potter doesn't hate Muggles at all. But in this fanfic, perhaps the author wants to explore a 'what if' scenario where something drastic has happened to make him have such feelings. Maybe he's been betrayed by a Muggle - in the fanfic world, this could be a made - up situation that sours his view on all Muggles.
One possible reason could be that he's tired of the constant danger and politics in the wizarding world. After all he's been through so much. He might just want a normal, quiet life away from magic.