The reasons that make animals hide are various. Some of them are trying to protect themselves from predators, while others are hiding in order to quietly watch for prey.
The most of these animals, though, are hiding for their safety. At the genetic level, each generation adapts better to the environment. After all, the nature is also in permanent changing. Some species are able to change their color, and the most striking example is the chameleon, and let’s not forget about seasonal color changing.