Mathfriend is right about H2O, but wrong about CO2. Although the O-H bond is certainly more polar than the C-O bond, both are still polar due to the electronegativity differences of the atoms. The full answer has to do with the shape of the molecule. Because CO2 is linear, the dipole moments between the central carbon and the two outer oxygens cancel out (the polarity of the bonds point in exactly opposite directions), resulting in an overall non-polar molecule. H2O, on the other hand, has a bent molecular shape, to that it's two polar bonds actually add to each other, resulting in an overall polar molecule.
H2O is polar because of the electronegativity difference between Hydrogen and oxygen. CO2 is non-polar becaue there is no significant difference in electronegativities between Carbon and oxygen.