Refraction happens when a wave (usually a light wave, but it can be water or other types too) enters a new type of medium. For example, when light goes through air and then hits glass. The light actually slows down when it enters the glass. This causes it to bend after it enters it.
It can bend further out, or closer in, but it always bends when the substance changes. A good way to see it is to imagine a marching band all walking together in unison. Suppose one side starts to walk on sand, but the other side is still marching on dry ground. A person watching them will see the entire line start to bend as the group on firm ground moves ahead while the band members on sand are walking slower. The picture below shows this example. The exact same concept holds with light refraction too.