A homogenous mixture would be defined as one in which we would expect to find the same ratios of each component at any place in the mixture. For example, if we put a few drops of blue dye in a glass of water, we know all of the water will take on the same shade of blue, because the dye has been evenly distributed throughout the entire mixture. In contrast, a heterogenous mixture is one in which the components "cluster" in different regions of the mixture, and typically you can see direct evidence of this in the form of different shapes, colors and so on. For example, mixing oil and water produces a layer of oil and a layer of water, both of which are distinct. If you shake that mixture, you'll get a heterogenous mix of oil "bubbles" in the water that rapidly return to their original configuration.
Sugar dissolves in water because both molecules are polar; "like dissolves like," as we say, and the polarity of the molecules allows them to find corresponding electrical charges on each other and match up in such a way that the homogenous mix is more electrically stable than the heterogenous one.
In contrast, oil is nonpolar, and so it won't dissolve sugar. This means the sugar and oil will remain distinct, and this will result in a heterogenous mixture.