This is because the atomic mass of an element is the weighed average of the atomic masses of all the isotopes of an element.
For example, oxygen occurs in nature as a mixture of isotopes16O,17O and 18O having atomic masses of 15.995 u, 16.999 u and 17.999 u respectively.The relative abundance of the three isotopes is 99.763%,0.037% and 0.2%.
Thus the atomic mass of oxygen is expressed as the weighed average of the atomic masses of these three isotopes.
Atomic mass of oxygen= [(99.763*15.995)+(0.037*16.999)+(0.2*17.999)]/100
= 15 u