Substances that have ionic molecules or polar molecules generally dissolve in water because water molecules have the ability to surround the those molecules completely and disperse them in solution. Non-polar molecules do not interact with water molecules and are therefore insoluble in water.
Water is a polar molecule. It consists of two hydrogen atoms attached to a central oxygen atom in a bent shape. The oxygen atom is more electronegative than hydrogen and has the tendency to attract bonded electron pairs towards itself, thus gaining a partial negative charge. The hydrogen atoms end up with a partial positive charge. The partial charges in a water molecule interact with other molecules that are charged.
Ionic molecules, when added to water, tend to split into positive and negative ions. The positive ions are surrounded by the oxygen atoms of the water molecules, since they have a partial negative charge, whereas the negative ions are surrounded by the partially positive hydrogen atoms of water. Since each ion is surrounded by water molecules, the ions are said to be hydrated and remain separated from one another. The ions are completely dispersed in water and are said to be soluble.
Polar substances are made of molecules that interact with one another through dipole interactions. The intermolecular interactions must be broken for the substance to dissolve in any solvent. When a polar molecule is added to water, the partial positive atoms of the polar molecule are attracted to the partial negative atoms of oxygen in the water molecules and the partial negative atoms of the polar molecule are attracted towards the partial positive atoms of hydrogen in the water molecule. This attraction breaks the dipole interactions between the polar molecules by redirecting the interactions to include water molecules as well. When each polar molecule is completely surrounded by water, the polar substance is said to be dissolved.