Zim explains that there were three different wormholes he initially considered: one led to a universe containing extremely itchy gas, another to a universe of pure dookie, and the last one led to a room with a moose. Zim chose the last wormhole.
However, the wormhole has a fork in it: one way leads to the room with a moose and one way leads them back to Earth. Dib foils Zim's plan to teleport everyone to another dimension after he discovers the fork and sits on the left side of the bus. The children then move to the right side of the bus to get away from Dib, and the weight causes the Skool bus to change its direction.
The wormhole is natural, and was merely discovered and navigated into by Zim. Nobody on the bus sees the wormhole (or even knows that they are in outer space) due to a screen projection on the windows that makes it look like they're driving through the streets of the city. The wormhole seems to be very close to Earth, and only opened when the bus approached it.