According to our current understanding of the formation of planets, they are created from dust which originates in a previous supernova (or other large) explosion. This is called a nebula.
As this nebula contracts into planets, there are generally two possible cases: that the dust that is eventually going to form a planet is spinning, overall, or not. The most general and likely case is that it is spinning in some form. There is no overall reason why it shouldn't, short of some "magical" combination of canceling factors.
What happens when this spinning dust cloud contracts under gravity? It spins faster (think of an ice skater spinning), due to the conservation of angular momentum.
Therefore, you end up with planets with a relatively fast spinning core.
Now, what keeps this spin going? Fundamentally, conservation of angular momentum. Nothing is keeping it going, and it's actually spinning down. It should eventually stop - in million or billions of years. That's how much momentum is stored in it :-)
Why does the crust spin slower than the core? For two reasons: since things spin faster as they contract, you naturally end up with a variation of speed between the outer layers and the inner core; secondly, the core is actually dragging the crust around, but the Earth is not really a solid so the drag cannot be thought of as a rigid motion.