NaCl2 is using a Sodium ion and Chlorine ions, but the charge on sodium is Na+ and on chlorine it's Cl-, so the real formula of Sodium Chloride is NaCl.
Silver chloride works the same way, Ag+ (silver) and Cl-, so the formula for silver chloride is AgCl
Oops, I meant AgCl2 because Silver usually is Ag2+
Ag has many oxidation states that include 2+, but the most stable one is 1+, which is the OS it takes when bonded to any halogen to form a silver halide: AgF, AgCl, AgBr, AgI