In some fanfictions, Naruto might be subjected to false accusations that he can't clear his name from. The public turns on him, and he feels hopeless. He might think that death is the only way to escape the constant persecution and the stain on his reputation.
One possible reason could be extreme loneliness. Naruto has always faced some degree of isolation in the original story. In a fanfiction, this could be exaggerated to the point where he feels there's no way out and becomes suicidal. Another reason might be the failure to protect his loved ones. If in the fanfiction, he fails to save his friends or the village multiple times, the guilt could be overwhelming.
In such a fanfic, it might be due to a false accusation. Suppose Naruto is wrongly accused of a heinous crime like mass murder in the village. Everyone turns against him, and he has no way to prove his innocence. This overwhelming sense of injustice and isolation could drive him to suicidal thoughts. Also, if he discovers some dark secrets about his past, such as his parents' real cause of death being related to some sort of betrayal he unknowingly caused, it could break his spirit.
One reason could be to explore the character's darker side. Tony Stark has been through a lot in the Marvel universe, and some fans want to dig deeper into his potential mental struggles, which could lead to thoughts of suicide.
Well, it might be an exploration of the psychological toll of being a superhero. Peter Parker constantly faces danger, loss, and has to keep his identity a secret. Writers may create 'suicidal peter parker fanfiction' to show how all these factors could potentially break him. Also, in the context of fanfiction, it could be a way to subvert the typical heroic narrative and show a more vulnerable and broken side of the character. However, it's a very heavy and potentially triggering topic.
It could be that the writer wants to explore the consequences of extreme distress in the context of the story world. Maybe they want to show how Percy's friends would react to such a situation, or perhaps they are using it as a plot device to create a very emotional and impactful story arc. Also, it might be a way to raise awareness about mental health issues in a fictional context, although this is a rather extreme way to do it.
Perhaps the discovery of some dark secrets about the ninja world could make him ruthless. For example, if he finds out that the village leaders have been using him or his friends for some immoral purposes all along. This new knowledge could shatter his world view and make him question all his previous beliefs, leading him to become a more ruthless individual who is out to change or even destroy the existing order.
Perhaps he has faced repeated failures in protecting his loved ones. If he constantly blames himself for not being strong enough to keep his friends safe, it could lead to self - loathing and suicidal tendencies. For example, if Sasuke leaves again and Naruto feels it's his fault, it might push him to the edge.
Perhaps a dark power corrupts him. In the fanfiction, there could be some sort of dark chakra or evil entity that latches onto Naruto. This entity could slowly eat away at his emotions, starting with his heart, making him gradually lose his ability to feel empathy and turn heartless.
Maybe Naruto discovers that the village he has been trying so hard to protect has been using him all along. He might find out some dark secrets about the Hidden Leaf, like they were involved in something immoral and were just using his power, which would shatter his idealistic view of the village and leave him heartbroken.
One possible reason could be a major betrayal he experienced. Maybe someone he trusted deeply, like a close friend or a mentor, turned against him. This would make him more guarded and distant to avoid getting hurt again.
One reason could be exploring dark themes in the Harry Potter universe in a more extreme way. Some fans might be interested in delving into the psychological struggles that could potentially exist in that world, even if they are very dark. Another reason could be a form of catharsis for the authors, who may be dealing with their own internal issues and using the fanfic as a way to express their feelings in a fictional context.