The lens is round, because of the shape the glass needs to be to have the lens-effect. Square glass lenses exist, but are way harder to produce.
The pictures that come out of the camera are square, because the sensor (or film in the old days) is square, because that is easier to produce.
So to match both together, the round lens projects a round image on the square sensor, but the round image is larger than the corner to corner measurements of the sensor. So parts of the round image are not captured by the sensor. But that is not a bad thing, because every lens has a "sweet spot" and bad edges. So the lesser part of the projected image mostly falls off.
Basically, camera lenses are round mostly due to the fact that it is easier to manufacture round lenses.
However, people generally want to view rectangular pictures so the solution camera manufactureres have decided on is to make the sensors rectangular. See below for more specifics.