Calcium is a metal (an alkaline earth metal, to be exact). A neutral calcium atom has two valence electrons.
Chlorine is a nonmetal (a halogen, to be exact). Elemental chlorine generally exists as a molecule of two chlorine atoms (Cl2). In any case, a neutral chlorine atom has seven valence electrons.
Calcium chloride (CaCl2) is an ionic compound that consists of one calcium cation (a positively-charged ion) and two chloride anions (negatively-charged ions). A calcium ion loses two valence electrons, which are gained by two neutral chlorine atoms.