A more straightforward answer to this question, I think, is that most of an atom's mass is comprised of a combination of the mass of the protons and the mass of the neutrons. While all atoms of the same element have the same number of protons, they do not all have the same number of neutrons, so the mass from atom to atom of an element may differ.
When you're using the mass of an atom in calculations, you usually have a large quantity of that atom. Since there is a mixture of atoms with many different numbers of neutrons, the atomic mass number is an average of the atomic mass of a bunch of atoms as it might be found in nature.
So if you were to take a lot of oxygen, let's say, out of the atmosphere, rocks, etc., the atomic mass number on the periodic table would be a good approximation of the average mass of each atom in the oxygen you got.