Question: why can atoms of the same element have different masses?
Answer: Different isotopes of the same element have the same atomic number. They have the same number of protons. The atomic number is decided by the number of protons. Isotopes have different mass numbers, though, because they have different numbers of neutrons.