The basic rule to be followed in determining which solvents will dissolve a compound is "like dissolves like". Polar compounds dissolve in polar solvents due to the fact that when polar compounds are placed in the polar solvent the solvent particles interact with the charged particles and decrease the electric field around them.
Solvents interact with compounds that are dissolved in them in many ways which include the formation of hydrogen bonds, polarization and the moment created by dipoles.These help the solute to dissolve and hence their presence decides if the solute is able to dissolve.
Polar compounds like sugars, inorganic salts like NaCl can easily dissolve in a polar solvent like water. To dissolve non-polar compounds like waxes, oils, etc., non-polar solvents like benzene are ideal.