Air at the equator is warmed by the direct rays of the sun while air at the poles is cooled because the suns rays are not so direct.
As air warms, it expands and becomes less dense therefore rises, similarly but vice versa for cool air.
This causes a pressure difference between the poles and equator causing cool winds to blow away from the poles close to the ground and warm air to move away from the equator at high altitudes, therefore a circular motion is created.
This circular motion along with the earth spinning causes a lateral forces and resulting in the winds to move around the earth rather than directly between the poles and equator, as a result the winds spin.
In the northern hemisphere, low pressure systems have winds spinning around them in an anticlockwise direction and high pressure systems in a clockwise direction but in the southern hemisphere it is the opposite.