when we mix colours such as paint together, the colours block out parts of the spectrum when they are mixed. this is called a subtractive colour system. Red, Yellow, and Blue; being primary colours in a subtractive colour system, create black when they are all mixed together because all parts of the spectrum are blocked out (absorbed) by the three colours.
when we deal with light however, the opposite is true. when beams of two different colours of light are placed on top of each other, a new colour is formed by adding the spectrum of one colour to that of another. this is known as an additive colour system. because the parts of spectrums are added, when beams of Red, green, and Blue light (RGB primary colours) are placed on top of each other, the result is white light.
the reason that there are different systems is because subtractive (RYB) system is used to describe physical objects and how they interact with light to produce colour. additive colour systems on the other hand involves the colour of light itself.
the phenomenon i have explained above can be seen below.