Let's say you have five snakes in a tank and you're tasked with finding all of them. The ones that don't fit in with their surroundings would be spotted quickly, correct?
Same thing, but "you" are either a predator or a prey. In the former, the snake gets eaten and can't reproduce. In the latter, the snake doesn't eat and starves to death, also not reproducing. Now a snake that isn't spotted can eventually reproduce and its camouflaging genes are passed on to the next generation.