It could be a magical deal. There might be a spell or a magical contract that somehow transfers the ownership of Grunnings to Harry. This could be part of a larger plot where some magical entity wants Harry to have a connection to the muggle world through Grunnings for some grand purpose, like unifying the two worlds or preventing some dark magic from affecting the muggles.
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.
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.
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.
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.
In fanfiction, Harry owning Grunnings could potentially be a very interesting plot twist. It might symbolize his connection to his muggle roots in a more powerful way. Maybe it gives him a source of income in the muggle world and also a way to keep an eye on the Dursleys without them knowing.
Well, in some fanfictions, it could be due to a powerful spell gone wrong that transfers the ownership to him. Maybe a spell meant to protect Diagon Alley's property rights backfires and suddenly Harry is the owner.
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 received it as a gift from another fanfiction enthusiast who knew his interest in Twi'leks.
Harry could be interested in the Muggle technology used in Grunnings. As a wizard, he has seen magic all his life, but the Muggle way of doing things fascinates him. Buying Grunnings gives him a chance to study and perhaps even combine Muggle technology with magic in some innovative ways.