In the games
Palkia was originally a Pokémon resident of Spacial Rift until recently, when the main character comes from the future and gets attacked by Darkrai. This caused a distortion in space, and outraged Palkia, who drags the main character and his partner to Palkia's domain, Spacial Rift. There, he intends to destroy the two characters; however, the two manage to defeat Palkia, and with Cresselia's assistance enter his dream. Palkia reveals that the two characters are distorting space to the point that not even he can control it.
Cresselia then arrives to finish off the characters, but Palkia notices that they don't appear to be motivated by malicious or evil intents, contrary to Cresselia's previous claims to him. He starts to get suspicious, and his suspicions are confirmed when the real Cresselia saves the characters from Darkrai's secret's plan to eliminate them. They then learn that Darkrai was the one expanding the space distortions, and Cresselia pulls them from the nightmare.
As Palkia can control space itself, Spacial Rift's exit is hidden, thus requiring the player to defeat Palkia at first.
After the characters and Cresselia defeat Darkrai at Dark Crater, he plans to escape into a dimensional hole with the intent to restart his goal of casting the world in darkness during a different time period. However, Palkia arrives and, infuriated at Darkrai's wicked scheme, blasts Darkrai just after he entered the dimensional hole. He explains to the player and partner that Darkrai was not killed, but like the player, his memories were erased, as well as his evil personality, and that he became a noble being, and the dimensional hole sent him somewhere random around the world.
Later, the player can recruit Palkia at Spacial Rift. In Explorers of Time and Darkness, this is required to unlock evolution for the main character and their partner.
For more information on this Pokémon's species, see Palkia.