Ionic compounds dissolve in water because the hydrogen and oxygen atoms in the H2O molecules have partial charges that attract the ions in the solid compound, causing it to dissociate into separated ions. Differences in electronegativity account for the partial positive charge carried by water's hydrogen atoms and the partial negative charge of its oxygen atoms. What is happening to the ionic compound when it dissolves is a separation of its ions from their preexisting solid crystal lattice structure into unattached ions that are free to move about in the solution.
Ionic compounds are those compounds, such as NaCl, or table salt, in which the ions are held together by ionic bonds. The opposite electrostatic charges between the ions create the bonds. Those ions which carry a negative charge are called anions and the positively-charged ions are called cations. In NaCl, for example, the sodium ions are the cations and the chloride ions are the anions.