The human tongue responds to a range of different substances, registering them as various tastes. Evolution programmed our gustatory sense to find nutritious things tasty, and un-nutritious things un-tasty — for the most part. Human beings are flexible about what they eat relative to many animals, hence our omnivore status, but there are many types of organic material that we are incapable of digesting, and hence perceive as unpleasant. Sugar is highly digestible and offers a very condensed source of calories, so to us it tastes good — and has a distinct flavor that we label sweet. All mammals, except cats, can taste and enjoy this substance and are more inclined to eat poor-tasting food if it contains some.
Scientists now know that the tongue is covered with tiny clusters of chemical sensors called taste buds. It is the geometric shape of incoming molecules that determines how they taste. Some foods have multiple molecules that all contribute to their overall taste sensation. There are several types of sugar that exist, but by far the most frequently consumed by humans is a molecule called sucrose. There are also other molecules, like saccharine, that taste sweet even though they aren't sugar, although the taste sensation is slightly different.