i saw a NOVA Science Now episode that seemed to indicate that they didn't know precisely how the solar system and our planet were formed about 4.5 billion years ago. we know, from meteorite composition that material cooked up in a super nova plays a part.
my best guess, as a non-astronomer (heck, I'm not even a physicist), is that going all the way back to the big bang, that there was lots of turbulence in it. big swirls of turbulence eventually became galaxies (that rotate), smaller swirls of turbulence inside the big swirls eventually become solar systems (that, for the most part, rotate). i can imagine that as hot and sticky material started to glob together eventually becoming planets, that there was some initial spinning of the aggregate of material also, the original angular momentum going all the way back to the very beginning. where else would the angular momentum come from?