|MadSci Network: Earth Sciences|
I could perhaps turn this question round. Perhaps you could ask yourself, why shouldn't it be tilted?. I could rephrase the question as to ask how come the Earth is tilted assumes that it is tilted with respect to something, and what it is tilted against is what is called the plane of the ecliptic - an imaginary plane in which all the planets (roughly) move as they rotate around the sun.
The planets move in this way because when the solar system was forming, it was a giant disc of gas and dust going around the sun. The planets condensed out of this disc. The earliest bodies are what are called planetesimals - they were up to a few hundred km in size, rather like the largest asteroids still around today. These collided with each other to form the large planets we see today, and on the whole, since they were orbiting around the sun in the same way, they would tend to form bodies that were spinning in approximately the same direction - that aligned with this plane in which they were orbiting the sun. But not necessarily! - collisions, and the way these bodies accreted together could make a difference in exactly which direction the early planets were spinning (the fact that the Earth and other planets are spinning is what defines our 'tilt'). A good example is the planet Uranus which is 'tilted' at an angle of about 98 degrees - it seems to roll around the solar system on its side although if you were standing on Uranus (if you could) the only difference you would notice was that the sun and the other planets would appear to rise and set in the north and south rather than east/west like on Earth.
Try the links in the MadSci Library for more information on Earth Sciences.