The degree by which the light is bent by refraction is related to the wavelength of the light, which means that different colours are refracted by different amounts. When you shine a white light through a refracting medium such as a glass prism, the difference in the angle of refraction for each wavelength is enough to split the beam into a spectrum of colours. Fans of Pink Floyd will recognise this effect from the famous cover of the album The Dark Side of the Moon, which resembles the diagram below.
Like the prism, lenses also work by the process of refraction, bending light to focus it on the film or sensor of your camera. Unfortunately the same effect that causes the beautiful rainbows to emerge from the prism causes a major headache for lens designers, because it causes different wavelengths of light, in other words different colours, to be focused at different points, with red light typically focusing behind the focal plane, while blue and violet light is focused in front of the focal plane.
There are a number of strategies for dealing with this problem. The most popular method is to use multiple lens elements made of different types of glass stacked together in such a way that their different refractive properties cancel each other out, bringing the different wavelengths closer to focusing on the same plane. The most common type of achromatic multi-element lens is known as an Achromatic Doublet, which consists of convex and concave lenses of crown and flint class sandwiched together.
There are a few other optical strategies for dealing with chromatic aberration, including special lens coatings, Fresnel lenses and special types of glass, but all of them involve complex optical formulas and sophisticated manufacturing techniques. The technology for dealing with chromatic aberration is the main reason that the best quality lenses are so fantastically expensive.