It could be due to some sort of experiment gone wrong. There might have been a magical experiment in the wizarding world that accidentally affected Harry's emotional capacity. For example, if there was an attempt to enhance his magical powers but it had unforeseen side effects on his emotions.
Maybe he was cursed by a dark wizard. Some powerful curses can mess with a person's emotional state.
Well, it would likely make his friendships very strained. His friends might feel constantly shut out. For example, when they're excited about something, Harry's lack of emotional response would be off - putting. They might start to doubt if he really cares about them at all.
It could also be related to his self - preservation in the wizarding society. In a world full of magic and danger, showing too much emotion might be seen as a weakness. Harry, being aware of this, decides to shut out his emotions to appear stronger. He has faced a lot of scrutiny and jealousy from some students and even some adults in the wizarding world. By suppressing his emotions, he hopes to be more respected and less of a target.
One possibility is that the fanfic changes Snape's backstory to make him more sympathetic. Harry, being empathetic, then feels safe around him. For instance, if Snape's past is shown to be full of hardships that made him act the way he did, Harry might understand and feel safer in his presence.
It might be related to his Sacred Gear. If there is some sort of malfunction or unforeseen side - effect of his Sacred Gear, it could lead to this situation. For instance, if his power is growing in an uncontrolled way, it could disrupt his normal bodily functions including sexual ones. Fanfiction authors often play with such concepts to create interesting plot twists.
One possible reason could be to protect himself from the pain and loss he has endured. After all he's been through, like the death of his parents, Sirius, and so many others, turning off his emotions might seem like a way to avoid further hurt.
In some fanfictions, Harry Potter might cause chaos by getting involved in time - travel mishaps. He could go back in time and accidentally change some crucial events. This would then have a ripple effect on the present and future, causing confusion, altered relationships, and a whole lot of chaos in the wizarding world. People who were once friends might become enemies, and old enemies could gain new advantages due to the changes in the timeline.
One possible reason could be to explore a different side of the character. By taking away his emotions, the writer can show how much emotions actually contribute to his actions and relationships. It's like a 'what if' scenario.
Perhaps he was cursed. In the wizarding world, there are many dark curses that could affect a person's mind, and one such curse could target his emotional understanding. Also, it could be due to his isolation. Harry has often been alone or felt alone, and this lack of regular social interaction with a diverse range of people could have made it difficult for him to develop a normal understanding of emotions.
In terms of his romantic relationships, if there are any in the fanfiction, it could be a major obstacle. Shutting out emotions means he may not be able to fully open up to a potential partner. This lack of emotional availability can make it difficult for the relationship to develop. For example, if he has feelings for Ginny, his inability to express his emotions might make Ginny feel unwanted or unloved, even though Harry might actually care deeply.
One possible reason could be a powerful jutsu gone wrong. Maybe he was hit by an enemy's attack that was specifically designed to numb his senses. Another reason might be some kind of psychological trauma. For example, if he witnessed something extremely horrible, his mind might have shut down his ability to feel as a form of self - protection.