Sugar dissolves in water because it is a polar substance, and water is also polar. Polar substances tend to interact well with each other. On the other hand, oil is nonpolar, and water is polar. They do not interact effectively, leading to poor solubility, and oil tends to separate from water.