The camera lens is a converging lens. Light rays from the subject enters the lens and the lens, due to the shape and density of the glass lens, emerge tracing out a revised path. This path resembles a cone of light. We focus the camera by moving the lens forward or backward. This action adjusts the position of the apex of the cone. We want the apex to just kiss the surface of the image sensor (or film).
Sorry to report that each color of light traces out a slightly different as to length, cone of image forming rays. Thus each color has a slightly different focal length. The length of the cone determines the size of the image as projected on the image sensor.
Violet light forms an image closest to the lens. Red forms an image the farthest while green, yellow and orange form an image in intermediate positions. Thus the image size (magnification) for each color is different. We see this as a rainbow of colors surrounding the image. This is a lens error called chromatic difference of magnification. We just say chromatic aberration.
A positive lens is convex (bulges outward). A negative lens is concave (bulges inward). Luckily they behave opposing as to chromatic aberrations. The camera lens mounts a strong positive lens and sandwiches in a weak negative lens. This combination midrates to a high degree, chromatic aberration. We call this sandwich an achromatic lens (without color error). No one has ever succeeded to make a lens that truly projects a faithful image. The lens maker is faced with 7 aberrations. They do their best but so far no truly faithful image. You get what you pay for. Countering the 7 aberrations means many lens elements, each with a different shape and some with dense glass and some made with less heavy glass.
Not all lenses are equal when it comes to countering aberrations.