The central, overarching twist of "Invader ZIM" is that Zim's entire mission is a lie. He was not chosen for a secret mission to conquer Earth; he was exiled by the Irken leaders, the Almighty Tallest, who find him intensely annoying and hoped he would die on his journey to a random, worthless planet. This fact is heavily implied throughout the series, as the Tallest constantly ignore his calls and mock him, but Zim's powerful delusion prevents him from seeing it. The truth is finally and explicitly confirmed in the finale movie, "Invader Zim: Enter the Florpus."
In "Enter the Florpus," Zim faces a crisis of faith upon realizing the Irken Armada is deliberately flying away from Earth and will never come. This leads to his brief surrender to Dib. However, he regains his confidence by formulating a new plan: teleporting the entire planet of Earth directly into the Armada's path. The plan nearly succeeds, but is thwarted by Dib, Gaz, and their father, Professor Membrane. In the climax, Dib gains his father's long-sought approval, and they manage to teleport Earth back to its proper location. The Irken Armada, however, is not so lucky; with Earth gone, they fly directly into the Florpus, a cosmic anomaly, where they are trapped in a dimension of eternal suffering, a fitting end for their hubris.
The series concludes with the status quo deceptively restored. Zim is back in his house, and his rivalry with Dib continues. However, the context has completely changed. Zim's grand purpose is gone; he now clings to petty victories, like stealing a small figurine from Dib's desk, and pretends it was his master plan all along. He has doomed his own people and is left with no real mission, only the rivalry that now defines his entire existence. Dib, having saved the world and earned his father's respect, has effectively won the larger conflict, even if their daily squabbles continue.