One thing that confused me when I learned science in high school was the connection between the spectrum of colors as seen in a rainbow, and the three primary colors. In case anyone else is confused here is my simple explanation.

While light, as you probably know, is composed of a mixture of colors as seen in a rainbow or when light refracts through a glass prism. There is a continuous range of these spectral colors, corresponding to a range of wavelengths of light from 0.00038 millimeters to 0.00075 millimeters. When white light falls on some surface and bounces off, the surface reflects different wavelengths by different amounts, we perceive the net result as some color. Therefore, to fully characterize such a color you would have to measure the amount that each wavelength is reflected. Depending on how accurate you want to be this would take many numbers, measuring how much each wavelength is reflected.

So how do we go from characterizing colors by many numbers to characterizing it as just three numbers? It turns out that the primary colors are not some property of light. Rather they are a result of how our eyes work. We have three types of color-sensing cell in our eye, each of which responds to a particular range of wavelength in respectively the red, green, and blue area of the spectrum. Our brains then combine these three basic signals to form our perception of colors.

This is clearest in how red mixes with green to form the color that is in between them on the spectrum, namely yellow.

Similarly green and blue form cyan, though it is a little hard to tell that it is in between the two primaries on the spectrum.

The really odd one is what you get when you mix blue and red. These colors are not next to each other, so the result magenta is not a color that is on the spectrum.

Note that the human primary color model would not work for many other animals. While most primates like us have the three types of color cells in their eyes, most other mammals have only two types of color cell, while many birds, reptiles, and fish have four (or maybe more) types of color cells.