A pencil looks bent in water because of a phenomenon called refraction. When light enters water, it cannot move as fast as it does in air. As light enters water at an angle, it bends away from its original path, and this makes the image look bent.
When the pencil is at an angle, the image in the water appears to be at a bigger angle, which makes the pencil look bent. Compare walking on land and wading in water. Walking on land is easier than wading through water. Similarly, light can travel quickly in open air but slows down when it enters water.