Like dissolves like

A substance dissolves well when the attractions it can form with the solvent are as strong as those it gives up, so polar and ionic solutes dissolve in polar solvents and nonpolar ones in nonpolar solvents.

From AP Chemistry.