The atomic number of chlorine is 17. An atom of chlorine has 17 protons. The mass of chlorine is the sum of all the elementary particles present in the atom which includes protons, neutrons and electrons. The mass of electrons, being very small is usually ignored. And the mass of protons and neutrons is considered to be equal.
As the atom of chlorine has 19 neutrons, the mass number of chlorine is 17 + 19 = 36
An atom's mass can be determined by the number of protons and number of neutrons it has. Electrons do not affect the mass because electrons are very small and its mass holds very insignificant value in comparison to protons and neutrons.
Every element has the same number of protons, which also coincides with their atomic number. The number of protons is essentially what determines what element an atom is. Neutrons, on the other hand, can vary in number. Some isotopes may be more common than others.
Chlorine's atomic number (number of protons) is 17. Simply add 17 to 19, and you have a mass of 36.