Spin is ubiquitous in the cosmos. Planets rotate, as do stars and galaxies. This comes about simply from conservation of angular momentum. When two ice skaters approach each other and link arms, they will start rotating — clockwise if they link right arms and counterclockwise if they link left arms. If two stars approach each other, gravity along with other effects might cause their mutual capture. The associated matter may form planets and other objects that share the original angular momentum and are all likely to rotate or spin with an axis along its original direction. This is a random process, so we would not expect the universe as a whole to have a net angular momentum, unless it had one originally.
Astronomy magazine subscribers can read the full answer for free. Just make sure you're registered with the website.