Hermione could be the one. With her vast knowledge of the wizarding laws and her sharp intellect, she might dig up some old regulations that prove Harry's right to his money. She would then fight tooth and nail in the wizarding courts or against the goblins at Gringotts to get his money back.
It could be a new character, perhaps an old and wise wizard who has a grudge against those who have wronged Harry in terms of his money. This wizard, having his own reasons, decides to use his influence and knowledge to assist Harry in reclaiming what is rightfully his.
Dumbledore might have left some sort of plan or clue before his death. Harry could find this and follow the instructions, which lead him to someone or something that helps him get his money. Maybe it was a hidden agreement between Dumbledore and the goblins that, when revealed, forces them to return Harry's money.
Maybe he discovers some legal loophole in the wizarding world's financial system that allows him to reclaim his inheritance. For example, if there was some improper handling of his family's vault by the goblins at Gringotts, he could use that as a basis to demand his money back.
In the fanfic, it could be that Harry has a very smart friend who helps him come up with a clever plan. For example, they might find a loophole in a contract that the person who has Harry's money was using to keep it. So, by exploiting this loophole, Harry is able to legally get his money back. Another possibility is that Harry has some special skills or powers in the story that he uses to his advantage. He could use his charm to persuade the person who owes him money or his intelligence to outwit them in a negotiation.
Maybe he wants to keep it safe from thieves. There could be dark wizards or even some of his schoolmates who might be tempted to steal it.
In some fanfictions, Harry might hide his money in a secret compartment of his trunk. He could use magic to create a hidden space where no one else can find it.
Harry Potter could use his money to improve Hogwarts in fanfiction. He might donate to renovate old classrooms, buy new equipment for the library or even fund extra - curricular activities for students. After all, he has a strong connection to the school and wants to give back.
He could be disillusioned with the wizarding world's politics and power struggles. So, taking his money and leaving is his way of getting away from it all. He might feel that he can't make a real difference within the existing system and decides to find his own path.
Maybe he needs the money to fund an independent research project. He's always been curious about certain magical phenomena, and withdrawing his money would give him the financial means to pursue that knowledge without relying on Hogwarts or the Ministry.
He might use it to buy rare magical artifacts. For example, he could purchase ancient wands or enchanted jewelry that have special powers. This not only adds to his personal collection but also gives him an edge in certain situations.
Perhaps there are some legal barriers. For example, the person who has his money might have some legal justifications for keeping it, at least on the surface.
In fanfiction, Harry Potter taking his money and leaving could lead to him becoming a sort of magical entrepreneur. He could invest his money in new magical inventions or start a business that helps underprivileged wizards. For example, he might use his wealth to open a school for those who can't afford to go to Hogwarts, teaching them basic magic skills and life lessons. This would not only give him a new purpose but also make a significant impact on the wizarding community at large.