Perhaps he succumbs to an old wound or illness that has been haunting him throughout the story. In fanfiction, the author might play with the idea of his age finally catching up to him, and he dies a peaceful death in his sleep or while reminiscing about his life.
There's a possibility that it's one of his old enemies who has finally found a way to defeat him. Maybe they've discovered a weakness in Logan's healing factor or have a new weapon that can kill him. For example, if it's a foe who has studied him for a long time and found a way to disrupt his mutant abilities.
Another scenario could be that Iron Man is poisoned or infected with a deadly alien virus. He tries to fight it off but eventually succumbs to it. His friends in the Avengers try their best to save him but are unable to. This would be a really tragic way for him to go, especially considering how much he has done for the team and the world.
One possible scenario could be that Spider Man sacrifices himself to save the city from a powerful and unstoppable villain. He might use all his strength and powers to defeat the enemy, but in the process, his body gives out due to the extreme exertion.
In some fanfictions, Peter might die heroically while saving the city from a powerful villain like Venom. He could sacrifice himself to protect his loved ones and the innocent.
Another scenario could be that Gohan contracts a deadly and incurable disease in the fanfiction world. Despite the efforts of his family and friends, including the use of any available advanced technology or magic, he succumbs to the illness, leaving everyone in mourning.
One possible scenario could be that Naruto was severely injured in a battle, perhaps against a powerful new enemy. He was brought to the hospital, but his injuries were too grave to be healed, and he passed away surrounded by his friends and family, leaving everyone in deep sorrow.
One possible scenario could be that Luffy sacrifices himself to save his crew during a major battle against an extremely powerful enemy. He might use all his strength and energy to protect them, and in the end, it's too much for his body to handle.
One possible scenario could be that Edward sacrifices himself to defeat a powerful and final enemy. He might use up all his alchemy knowledge and power in one last, desperate attempt to save the world, and his body just can't take the strain.
One possible scenario could be that they sacrifice themselves to save the village from an ultimate evil. They might combine their powers in a final, desperate move that exhausts them completely, leading to their deaths.
One possible scenario could be that Peter sacrifices himself to save others during a crucial battle in the Endgame - like situation in the fanfiction. Maybe he uses his powers to hold off a powerful enemy while the rest of the heroes complete a vital task.