Animals react to how they feel certain things. If they don’t feel comfortable around them because they aren’t suited to their surroundings, they will feel alert and scared. For example: a green snake can hide in trees and blend in. But if that snake isn’t with a suited area, he will most likely get attacked, because he can’t blend in.
So natural selection plays a big part on how animals react or behave because animals may or may not be suited to their surroundings.