It’s a language model. You can think about it this way:
What follows after “the”? A: almost anything.
What follows after “the apple is”? It could be red, yellow or rotten.
What follows after “the apple color is”? Now is most likely a color, because in the training data there are numerous examples like these. Still could be red, yellow, green, but probably not black or white. Or maybe there was a fantasy story somewhere where an apple was black. Even if not, it is most likely a color next, and in other contexts black pops up as a color.
And so on. Is very simplistic but essentially something very similar is at work.