The first point is that 'warm' and 'cool' are relative terms. It depends what you are comparing it with. So while in general blues are cool and yellows and reds are seen as warm, when you compare various blues, some will also be warmer or cooler than others.
Why is it important?
Warmer colours appear to come towards you, cooler colours appear to recede. So if you want to make an object appear further away you cool it down for example you might make it more blue or if it is blue, make it a cooler or a more neutralised blue.
The second point is that temperature is only part of the equation. The colour intensity is another. How much light does it reflect? Yellows reflect the most light, purples the least, but yellow is not the warmest colour, nor purple the coolest. Orange is actually the warmest colour - it is made from two warm colours (yellow and red). A cool blue - such as phthalo blue - is the coolest colour. This can cause confusion since phthalo blue is so intense and bright.
How does it work for painting?
A cool yellow (lemon - leans towards green) mixed with a cool blue (such as phthlao blue - leans towrads green) will mix super bright intense greens as there is no red in the mix to dull it down.
A warm blue (ultramarine - leans towards purple) mixed with a warm yellow (Indian yellow/hansa yellow deep etc - leans toward orange) will produce dull greens as both the yellow and blue have some red in them to dull the mix.