why is the photograph taken by the camera is square-shaped?
The shape of the image is determined by the shape of the sensor, not the shape of the lens.
Sensors are generally rectangular for two reasons: 1) rectangular photos fit better into rectangular books, frames, etc., so people expect photos to be rectangular; and 2) it's easier and more efficient to fabricate rectangular sensors.
Lenses are circular because they need to have radial symmetry so that they refract light from any direction equally. You'd be very unhappy if turning your camera from landscape to portrait orientation changed the way the image looks -- it'd be like taking a photograph in a funhouse mirror. Rectangular optics exist, but these are usually either circular lenses with the edges cut off (to save weight or space), or anamorphic lenses that intentionally compress or stretch the image in only one direction (to fit a wide image on a not-so-wide sensor).