RGB is used for screen
RGB uses light to create different colors. Because of this, it has a much larger color gamut than CMYK. RGB is used for anything meant to be viewed on a screen, such as websites.
CMYK is used for print
CMYK creates colors from varying amounts of 4 colors of ink. This color space is not always as vibrant as RGB and cannot always recreate the exact same colors. CMYK is used for printed materials.