Basically Avogadro's number is the conversion factor from atomic mass units (daltons) to grams: 6.02x1023 amu = 1g. Therefore, if you have a mole of oxygen atoms each weighing 16 amu each, the mass will be (6.02x1023 x 16) amu. If you apply the conversion factor, you get:
(6.02x1023 x 16) amu x (1 g/6.02x1023 amu) = 16 g
This is why the mass in grams of a mole of a particular element is equal to that element's atomic weight.