Cold air comes from the poles and warm air comes from the equator, Wind systems spin because the earth is rotating on its axis, Much of the warm air masses comes from the over water because water holds heat better than land, So the wind systems are like an energy distribution system they balance out the atmosphere by redistributing heat from equator and cold form poles.
When cold air meets warm air it is forced up because cold air is more dense, the warm air will cool, condense, and rain.