The mass of an atom is determined by the number of protons, neutrons, and electrons it contains.
Protons and neutrons contribute significantly to the mass of an atom, as they are much more massive compared to electrons. The mass of a proton is approximately 1 atomic mass unit (u), while the mass of a neutron is also around 1 u. In contrast, the mass of an electron is significantly smaller, about 1/1836th of a proton or neutron.
Different elements have different numbers of protons, which define their atomic number. For example, hydrogen has one proton, carbon has six protons, and gold has 79 protons. Since the mass of a proton is relatively constant, elements with more protons will generally have greater atomic mass.
In addition to protons, the number of neutrons in an atom also affects its mass. Isotopes are atoms of the same element that have the same number of protons but different numbers of neutrons. As neutrons have a similar mass to protons, adding or subtracting neutrons can significantly affect an atom's mass without changing its chemical properties. Isotopes with more neutrons will have a greater atomic mass.
Electrons, on the other hand, contribute very little to the overall mass of an atom due to their tiny mass. While electrons do play a crucial role in chemical reactions and bonding, their effect on the mass is negligible.
In summary, the variation in atomic mass among different atoms is primarily due to the different numbers of protons and neutrons they possess.