An ion has an electrical charge because it either has more electrons than protons or it has more protons than electrons. Electrons, which are found in the shells of an atom, have a negative charge, while protons, found in the atom's nucleus, have a positive charge.
Normally, an atom has the same number of electrons and protons, so the atom's charge is zero. If an atom loses an electron, the way sodium loses an electron when it bonds with chlorine to make salt, the resulting ion is positively charged and is called a cation. An anion is an ion that has picked up an electron, making it negatively charged.