Ash and friends arrive at Moro Island where there's an Orange League trophy from 300 years ago on display at the museum. Only it was stolen by (who else?) Team Rocket. They follow them out to see when a thick fog appears and out of nowhere a ghost ship does too. After team Rocket tries (and fails) to get the trophy back Haunter possesses Meowth so it can speak with Ash and Friends about why the trophy should stay with them. Gastly provided illusionary visual aids making them experience the sensation of traveling back in time. They see the history of the captain, how he perished and how 300 years later deep-sea explorers took his most prized possession and unknowingly awaken Gastly and Haunter. Gastly also shows Ash and co. that the captain was a great Pokémon trainer and he had earned the trophy. After seeing this Ash agreed that the trophy should go back to its rightful owner. After they get off the ship it floats away into the heavens, and thus, Ash and friends continue on their journey.
This is the second episode where a Pokémon used Meowth to speak through it by possession. The first being IL019, Tentacool and Tentacruel.
The Orange League was founded over 300 years ago, given the existence of a trophy from that long ago. It is unknown how this compares to the other Leagues in Kanto, Johto, Hoenn etc.
Despite the ship sinking violently in a storm, the trophy and Gastly and Haunter's PokeBalls were still neatly arranged on the table when the divers found them.
For some reason, the divers that took the trophy from the ship completely ignored the two PokeBalls right in front of it, despite being of historical value just by their presence on the shipwreck.
Gastly and Haunter's story omits the ultimate fate of the Captain after his sink sank, although he has clearly died by the time they are awakened.
Gastly and Haunter were shown to be kept within modern PokeBalls despite being from 300 years ago. However, Pokemon 4Ever - Celebi: Voice of the Forest would show trainers such as Samuel Oak using primitive wooden-looking PokeBalls only 40 years ago, making the regular red/white PokeBalls a relatively recent invention.
300 years ago humans still used horse and wagons and didn't have cameras, yet in the Pokémon world they had cameras and pokeballs back then. One explanation is that human technology was around back then, it just advanced very slowly to what it is now. Another explanation is that the picture was taken in the modern era and ash and co are 300 years in the future, which can explain many adance technologies such as the pokeballs, pokeball teleportation system, porygon, pokedex, dextar, etc.
The "Who's that Pokémon?" in this episode is Gastly.