One possible reason could be the trauma he has faced. Harry has endured a great deal of pain, from the loss of his parents to the constant battles and threats in the wizarding world. He might want to escape all that and find peace away from it.
Another reason could be related to his desire for a different future. He has always been in the spotlight in the wizarding world, and he might want to step away from that fame and build a life on his own terms, away from the expectations and chaos of the wizarding world.
One possible reason could be that in some fanfics, the author wants to explore a different side of Harry. Maybe he's tired of the constant chaos and danger in the wizarding world. Another reason might be to show his independence from the typical wizarding narrative. He could be seeking a more normal life away from all the magic and politics.
One possible reason could be extreme anger. If something really bad happened to his loved ones, like if Voldemort came back in a different way and killed all his friends and family this time, Harry might be driven to the edge and decide to destroy the wizarding world that couldn't protect them.
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.
The plot could start with Harry making a firm decision to leave. He might go into hiding in the Muggle world, changing his appearance and identity. Then, the wizarding world would gradually realize his absence and start to search for him, which could lead to a cat - and - mouse chase.
Perhaps he leaves in search of a more peaceful life. The wizarding world, despite its magic, has been filled with turmoil for him. He could be seeking a place where he can simply be Harry, not 'The Boy Who Lived' or the hero who defeated Voldemort. He may also be on a quest to discover more about his family's past in the Muggle world, something that has been somewhat overlooked in his life in the wizarding world.
One reason could be that he's tired of the constant danger and battles. After all he's been through, he might just want a normal, peaceful life away from magic. Maybe he wants to start a family in the Muggle world where his kids can grow up without the threat of dark wizards.
Well, in the traditional sense of the wizarding world of Harry Potter, it seems quite out of place. Wizards rely on magic, not mechanical constructs. However, if we consider a fanfiction scenario, anything can happen. Maybe Harry discovers some ancient magic that allows him to combine magic with technology in a way that enables him to build a mech. It could be a mech that uses magic as its power source, with spells inscribed on its parts for various functions.
It could be about Harry Potter achieving ultimate power and ruling the wizarding world. Maybe he overcomes new and even more dangerous dark forces and in the process, he becomes the king. He could make new laws and bring about great changes to Hogwarts and the entire wizarding community.
Perhaps he feels disillusioned with the wizarding society. There could be issues like corruption or inequality that he can't bear anymore, so he decides to leave. For example, if the Ministry of Magic starts to misuse its power, Harry might not want to be part of such a world.
In some cases, he could be leaving in search of a greater purpose. He might feel that there are things he can learn or achieve outside the wizarding world that will ultimately help the wizarding community more. He may also leave because of some prophetic vision or a feeling that he doesn't belong there anymore, that his path lies elsewhere, away from the familiar magical realm he grew up in.