CMYK and RGB colorspaces or modes are distinct options that one can set when dealing with digital imagery (raster or vector). As CMYK is the color of inks used in the offset printing process and RGB is the color of the light emitted from a computer monitor, each colorspace has a specific use. CMYK is generally is used for producing and printing photos (where the colorspace of such can be easily manipulated by adjusting tones, contrast and mixing the color palette via Photoshop) while RGB is used for viewing images on screen (usually as vector and via Illustrator).
The specific reason for why CMYK and RGB are different is because each (while containing prominent colors of the color spectrum) uses color differently. One can still obtain yellow, for example, in both CMYK and RBG but they won’t be exact shades. RGB produces projective light and CMYK produces reflective light which respectively, means that they help make color sharply visible for viewing and dark enough where needed (to show color range) for printing.