Zim is a member of the mighty Irken race, a species of aliens whose social hierarchy is based on height. The Irken leaders are the Almighty Tallest (during the course of the show, leadership of the Irken Empire is shared by two Tallest who are exactly the same height).
Zim was banished to the planet Foodcourtia as a frycook for the remainder of his life for destroying a sizable portion of an Irken city with a giant robot, known as the Frontline Battle Mech.
The robot was part of Operation Impending Doom I, a major galactic conquest venture by the Irkens. Zim was overeager (as usual) and activated his robot before leaving his home planet, much to the chagrin of his leaders.
Upon hearing of Operation Impending Doom II, Zim "quits" being banished and arrives at the Great Assigning where Irken Elite soldiers are chosen to become Invaders, special soldiers whose mission it is to blend in with the indigenous life forms of their assigned planet and collect intelligence.
Zim pleads with the Tallest to assign him a planet, and in a desperate act to get Zim as far away as possible, assign him to a "Mystery Planet", which turns out to be Earth.
The show features the exploits of Zim trying to conquer the Earth while his arch-nemesis Dib tries to stop him. The exact year on Earth is unknown, but given some rather striking technological and societal changes, the series is evidently set at some point in the future.