We consider that consonant intervals sound pleasing while dissonant intervals do not.
Consonance and dissonance are culturally determined. That is, different cultures might consider the same interval as pleasing or not. Even in Western music, the definition of consonant and dissonant intervals changed somewhat through history.
Today, we consider consonant intervals are: the perfect prime, minor and major third, perfect fifth, minor and major sixth and perfect octave. The other intervals are considered dissonant intervals. The most consonant intervals are the unison and octave. The most dissonant intervals are the minor second and major seventh because the tones in both of these intervals sound very colliding with each other. The perfect fourth is a special case: sometimes it is considered a consonant interval and sometimes it is considered a dissonant interval.
Dissonant intervals are used to build tension, while consonant intervals are used to release tension. Since music continually builds and releases tension, dissonant intervals are usually resolved into consonant ones. The next figure shows two typical examples. The first one shows how the tritone (realized as the augmented fourth), which is a dissonant interval, can be resolved to the minor sixth which is a consonant interval. The second one shows how the tritone (realized as the diminished fifth), which is a dissonant interval, can be resolved to the major third which is a consonant interval. In both examples, the resolution is very smooth since both tones in the interval move the shortest possible distance: one half step.
Figure: The tritone resolved to the minor sixth and the tritone resolved to the major third