A simple atom has an equal amount of both negative and positive charges, which makes it neutral. Also, where the about of electrons are equal to the atomic number.
Atoms are neutral because they contain the same amount of protons and electrons. An electrically charged particle called an ion is produced when electrons are removed from a neutral atom to give a positive charge or when electrons are added to a neutral atom to give a negative charge. Since the number of protons and electrons are the same, the electric charges cancel one another making the atom neutral.
Barium has a 2+ charge as it is in group 2 in the periodic table and so it has two electrons in its outer shell and chloride has a -1 charge on its chloride ion. So we will need two of the chloride ions as we have a 2+ charge to match the amount of charge on one barium ion- forming barium ion