There's a possibility that it's a villainous trainer. This trainer might capture Gengar with the intention of using it for evil purposes, like using Gengar's powers to steal other Pokémon or cause chaos in Pokémon battles.
Maybe it's an old foe who has managed to regain power and wants to make Sora pay for past defeats. For example, a powerful dark sorcerer who was once defeated by Sora but has now found a way to capture him through some devious plot.
Maybe it's a group of poachers who are after rare Pokémon. Gengar, being a relatively unique and powerful ghost - type, would be a valuable catch for them. They could plan to sell Gengar on the black market for a high price.
Well, perhaps Gengar is captured by a powerful trainer. The trainer might use a special Poké Ball to catch it. Then, Gengar could try to escape from the ball by using its ghostly powers.
In some fanfictions, when Gengar gets captured by Ash, it might lead to some really interesting team dynamics. Ash could use Gengar's unique abilities in battles. For example, Gengar's ability to phase through walls could be used in creative ways during gym battles or against Team Rocket. Maybe Gengar would initially be a bit rebellious, but over time, it would grow to respect Ash as its trainer. Ash would also have to find new ways to train Gengar compared to his other Pokémon, since Gengar has different strengths and weaknesses.
It could be the Blackbeard Pirates. Since they have a history with the Whitebeard Pirates, they might capture Marco to get information or as a form of revenge.
It could be the Marines. They've been after Luffy for a long time, so it's possible they finally manage to capture him in this fanfiction.
It could be the League of Villains. They've always been interested in taking down heroes and Deku, as a rising hero, would be a prime target for them.
The story could develop in many ways. For one, Ash might enter new tournaments with Gengar by his side. Gengar's presence could attract the attention of other trainers who are either scared or intrigued. This could lead to some unique battles where Ash has to prove that he can handle Gengar well. Also, Gengar might have some secrets or a past that gets revealed as it spends more time with Ash. Maybe it was once part of an evil team but now has a chance to be good with Ash as its trainer.
It could be Captain Hook. He has always been Peter Pan's nemesis and has a strong motive to capture him. Maybe he wants to finally get revenge for all the times Peter has outsmarted him.
It could be Discord. He loves causing chaos and might capture Twilight Sparkle just for the fun of it or to disrupt the harmony in Equestria.