In the fanfiction, it's possible that the castle was given to Harry by a powerful magical being. This being recognized Harry's pure heart and his need for a place of his own. Or perhaps Harry won it in a magical contest. He had to overcome many challenges and prove his worth, and as a result, he was granted ownership of the castle.
Perhaps he discovers the planet during one of his adventures. He could be using a new spell that accidentally transports him to this uncharted planet, and then through some series of events, he becomes the rightful owner. For example, he might save the planet from a great evil and as a reward, the planet's native beings make him the owner.
Maybe he inherits it. In the wizarding world, there could be some old family connections or a will that passes the ownership of the bank to him.
Perhaps he uncovers some major corruption or inefficiency in the Ministry. So, as a result of his efforts to reform it, he is given control. For example, if he finds that the Ministry has been misusing magic for personal gains, he could lead a movement to take it over and run it in a more just way.
He might have discovered the island during one of his adventures and claimed it as his own. Since there was no one else on the island at the time, and he was the first to set foot on it and recognize its potential, he decided to make it his property.
It could be that the dragon was an egg he found by accident. He, being curious and having a soft spot for magical creatures, took the egg and hatched it, thus becoming the owner of the dragon. In the wizarding world, there are often unclaimed or lost magical items and creatures, and Harry might have just stumbled upon this dragon egg.
The castle might be a grand and ancient structure. It could have high turrets reaching towards the sky, with thick stone walls that have withstood the test of time. There might be a large moat around it, filled with mysterious creatures. The interior could be filled with secret passages and rooms, just like Hogwarts. There could be a great hall with a long table for feasts and a fireplace that always has a warm fire burning.
There's a possibility that after Sirius's death, Harry just sort of took over. He had already spent time there and knew the place well. The remaining members of the Order of the Phoenix, seeing his connection to the place and his leadership potential, supported his claim to Grimmauld Place.
Yes, there are likely many fanfictions where Harry Potter is depicted as living in Potter Castle. Fanfiction writers often like to explore different scenarios for their favorite characters, and having Harry live in his family's castle could be an interesting concept.
He could use the money left to him by his parents. They were wealthy and it's likely there was a large inheritance waiting for him. Plus, he had his own earnings from winning the Triwizard Tournament.
Well, in some fanfictions, Harry Potter might come to own the Ministry of Magic through his heroic deeds. He could have defeated a great evil that threatened the wizarding world so severely that the wizarding community decides he is the most fit to take over and reform the Ministry.