Count Pumpka is a one-off character from "A Festival Trade! A Festival Farewell?"
Count Pumpka runs things from his castle during the Gourgeist Festival. He's basically a Pumpkaboo enthusiast—so much so that when he spots Jessie's Pumpkaboo, he becomes immediately obsessed. His own Pumpkaboo falls head over heels for her, which kicks off the whole mess. He invites Team Rocket to his castle for a meal and straight-up asks Jessie to trade her Pumpkaboo to him.
Jessie sees an easy mark and lies, claiming Ash's Pikachu has been threatening her Pumpkaboo. She tells Count Pumpka that if he gets Pikachu for her, she'll think about the trade. He sends his steward to track down Ash and his group, which eventually leads to them crashing into the castle.
Count Pumpka, convinced they're troublemakers, has them locked up. When Jessie still won't hand over her Pumpkaboo, he sweetens the deal by offering his Mawile—and more importantly, mentions that Mawile can Mega Evolve. That's the hook. Jessie agrees, they make the trade, and her Pumpkaboo immediately evolves into Gourgeist. Problem is, Count Pumpka's own Pumpkaboo loses all interest in her the moment she's no longer a Pumpkaboo. Jessie regrets the whole thing and demands they trade back. Count Pumpka agrees since his Pumpkaboo doesn't care anymore.
Meanwhile, Ash and friends break free and reveal the real villains: Team Rocket. After Team Rocket gets blasted off, Count Pumpka apologizes for the mix-up and invites everyone to dinner to watch the festival fireworks.
Content compiled by AnimeList.moe from publicly available sources.