As you know, the job of the lens is to project an image of the outside world onto the surface of the camera’s image senor (or film). As the light waves from the vista traverse the glass lens, the direction of their path is altered. These light rays are refracted (bent inward) tracing out the shape of a cone. When we focus, we are adjusting the distance, lens-to-sensor, so that the apex of this image cone just kisses the surface of the sensor.
Now all lenses suffer from seven major glitches we call aberrations. The lens maker attempts to mitigate each by constructing the lens using several individual lens elements. The result is an array consisting of different densities of glass, each with a different shape. Some of these elements are air-spaced apart, some are cemented together. The result is a complex optical system that delivers an acceptable image. The bad news is, try as we might, their remain traces of all seven aberrations.
When it comes to the way lenses handle color, each will come to a focus at slightly different distances, downstream from the lens. The good news is, a convex (bulges outward) and a concave (thinner at the center) lens has the opposite color error. The lens maker sandwiches this pair together, and this greatly cancels most of this error called chromatic aberration. There are actually two types of chromatic aberration which likely should be called chromatic variations of the focal length.
The key to understating the effect of these color errors lies in the fact that focal length determines image size. The further downstream from the lens, the larger the image. In other words, this error results in producing different size-colored images. The violet image forms closest to the lens. The red image is further from the lens, thus it is slightly bigger. Each of the other colors comes to a focus at intermediate distances. The color fringing you see is caused by the fact that each color image is stacked (overloaded) and each differs as to size. What we get is a rainbow of color fringing surrounding the image of objects. Also, the longer the focal length of the lens, the more the differences in image size, the greater the color fringing.