Remember internet kerfuffle that was 'the dress' ? Well, there's another optical illusion that's puzzling the internet right now. Behold: the red strawberries that aren't really red. Or more specifically, the image of the strawberries contains no 'red pixels.'
The important distinction to make here is that there is red information in the image (and, crucially, the relationships between colors are preserved). But despite what your eyes might be telling you, there are no pixels that appear at either end of the 'H' axis of the HSV color model. i.e. there is no pixel that, in isolation, would be considered to be red, hence: no 'red pixels' in the image.
So it's not that your brain is being tricked into inventing the red information, it's that your brain knows how much emphasis to give this red information, so that colors that it would see as cyan or grey in other contexts are interpreted as red here.
As was the case with 'the dress,' it all relates to a concept called color constancy, which relates to the human brain's ability to perceive objects as the same color under different lighting (though in this case there are unambiguous visual cues to what the 'correct' answer is).