the first number has to do with cold flow properties. each 'grade' pertains to a different test point temperature, and the oil has to fall within a certain viscosity number at that temperature to fit that grade. The second number is its viscosity at 100C, which is relevant to operating temperature.
In reality, most ambient temperatures fall in a range where there is little difference between a 0w-, 5w-, 10w-, etc. In fact, depending upon the temperature/viscosity behavior of the oil, a 0w- may in fact be more viscous than a 5w- or 10w- at some temperatures. This is counter-intuitive, and there is a lot of misinformation that exists.
Hope this helps!
JMH