Alcohols can form H-bond with water molecules and break the H-bond already existing between the water molecules. Therefore, they are soluble in water.

On the other hand hydrocarbons do not have the ability to form H-bond with water molecules. Hence they are insoluble in water.