Our solar system formed from a huge cloud of dust and gas, that was probably a remnant of a huge star that decided to opt for bang rather than whimper in leaving this universe. As this maelstrom a star guts began to collapse in on itself under the relentless pull of gravity it started to rotate. It began to rotate due to the conservation of angular momentum and like an ice skater pulling in their arms mid twirl, this causes rotation to speed up. It would be fair to say that the collapse of a cloud of gas larger than our solar system is rather more significant than pulling your arms into your chest and so even the slightest rotation of the initial cloud is exacerbated tenfold.
It is this rotation that is responsible for all of the planets in our solar system orbiting the sun in the same direction and on ruffly the same plane, they are after all remnants of the flattened disk of gas and dust that was present around our forming star. As this disk began to clump into eight significant lumps of matter that would become the planets, our friend angular momentum caused these clumps to rotate. This is why all of the planets spin giving us night and day. More than this they all spin along the same axis and in the same direction, all that is except Uranus and Venus. Now Uranus spins anticlockwise like all the other planets in the solar system, but it rotates on its side. Uranus then is the drunk Uncle of our solar family. Venus however spins along the same axis as the rest of the planets but in the opposite direction, the odd kid on the block indeed.
The question is how is this possible. The planets were all formed from the same collapsing cloud and so should all spin the same way. The answers to the oddities of Venus (and Uranus) is likely to be huge collisions. The civilised solar system of today with asteroids largely contained to a belt and planets in well behaved, regular orbits did not just pop into existence. Like a moody teenager our young solar system was a far less stable place where collisions between planets, protoplanets and giant asteroids were not uncommon. In this wild west of a solar system, a collision between a young Uranus and a huge asteroid would be sufficient to knock Uranus onto it’s side and such a collision could be enough to reverse the spin of the smaller Venus. The affect of a huge collision all depends on the trajectory and impact point of such a collision. For example, a huge impact with the Earth is what is believed to have formed the moon but if the impact site or trajectory had been different perhaps we too would spin the other way. Such collisions are thankfully no longer common place because the rogue asteroids of the early Universe have been brutally mopped up in historic collisions for the most part. If such an impact were too occur now, spinning the other way would be the least of our worries but rest assured collisions of this nature are mercifully infrequent.