First of all, polarity refers to separation of charges in a molecule; or the existence of partial charges in the overall structure of a molecule. Polarity of a molecule primarily results from two things:
1. Difference in electronegativity of bonded species. The higher the difference between the electronegativities of the bonded atoms, the more polar their bond gets. In the case of water, this bond would be the O-H bonds, and in carbon dioxide, this would be the C=O bonds. Both of these bonds are polar due to the difference in electronegativity of O and H, and of C and O (O being more electronegative, and hence has the tendency to pull the electrons closer to its nucleus).
2. Assymetry of the molecule. Even though there is difference in the electronegativity of bonded atoms, the resulting molecule may not be polar if the entire molecule is symmetric. This can be explained by looking at the forces as vectors, and performing vector addition. Let's try to compare the structure of water and carbon dioxide. Water is a bent molecule due to the lone pairs present in oxygen. On the other hand, carbon dioxide is linear. In carbon dioxide, the carbon is flanked by the oxygen atoms ( O=C=O). Each C=O bond is polar with O pulling the electrons towards itself. Since you have to identical AND opposing forces, the effects cancel, and the result is a non polar molecule of carbon dioxide. The same cannot be said with the bent molecule of water. The forces do not cancel because water is not a symmetric molecule.
In summary, polarity of individual bonds do not relate to the polarity of the entire molecule. The polarity of individual bonds is necessary for a molecule to be polar, but it is not a sufficient reason. The molecule must also be assymetric (since symmetry might 'cancel' the effects of the polar bonds).