The human visual system (i.e. eye + brain) processes chroma (e.g red vs green) differently to luminance (i.e. light vs dark colours). In particular the brain derives fine detail and texture from luminance information, but treats chroma as a much more "broad brush" thing. This is why something like red text on a green background is so hard to read: your brain needs to pay attention to fine detail in the chroma rather than the luminance, and its not set up to do that.
(Aside: The technical term for fine detail is "high frequency"; i.e. the brightness or colour is changing a lot in a small amount of space, whereas a large uniform area with only gradual change is "low frequency").
This fact has long been known and exploited for image transmission. The earliest use was hand-tinted photographs before colour film was invented; people found that you could get a surprisingly realistic "colour" picture by brushing coloured dye over a black-and-white photograph. You didn't need to worry about detailed shading, just brush some blue over the dress, flesh tone over the face and hands, green and blue over the background, and hey presto.
Analog colour TV used the same trick. Notice how much less bandwidth was given to the "chroma" (colour) information compared to the "luminance" (i.e. black and white) signal in this diagram of the frequency bands within a PAL TV signal:
JPEG and MPEG do this too. The colour information in the image is first "down-sampled", typically to half the resolution in each direction so that one colour pixel is used for each 4 monochrome pixels. Then the monochrome and colour information are separately compressed by a lossy algorithm that typically throws away even more of the colour detail. Your brain doesn't notice. (Incidentally this is why the picture posted by the OP has such a blurry colour grid when you look closely).
So now on to the illusion above. The grid is, in effect, fine colour detail. However the brain ignores the detail of the grid and instead perceives broad swatches of colour over the same areas, leading to the illusion.