A lens, in its most basic form, acts like the curvature of your eye. Almost all lenses are curved in some way, shape, or form. If you peer into that piece of glass on the front of your camera, you will most likely see that at least one piece of glass back there somewhere is curved. The purpose of this curve is to gather light and focus it on a single point back inside the camera.
The light you see is coming from all around you and is not simply linear or perpendicular to your eye. Actually the light comes at your eye, or your camera, from every angle imaginable. This means that the curved glass in a camera lens gathers that light from many angles (it can never grab it from all angles but it does its best) and bends that light in order to focus the light onto a single point in the back of the camera.
Once focused properly this light creates a crystal clear image of the world outside the camera.