“Consider the standard naturalistic explanation for the origin of life, which is that all life evolved unguided through natural selection (and some other mechanisms like genetic drift) working on random genetic variation. All the diversity of life is explained in this way. The trait of natural selection favors are those that confer on the recipient a survival advantage. So ultimately the origin of our beliefs too must be explained in terms of survival.
Natural selection works because some mutations confer on the recipient a survival advantage, allowing such individuals to propagate more abundantly than their less well-adapted relatives. While other genetic variations may occur, if they do not affect survival positively or negatively, natural selection cannot work on them. For example, natural selection may provide for sharp horns on water buffalo, but it would not account for a trait such as blue eyes (assuming for argument that blue eyes grant the water buffalo no survival advantage).
Natural selection can also work on inheritable traits that regulate behavior. So the water buffalo fortunate enough to inherit a gene that disposes it to run away at the sight of lions will survive to reproduce beyond its unfortunate cousins who see lions as potential mates or furry friends.
Superficially it might seem that this explanation would allow for the production of systems that produce true beliefs, since true beliefs are likely to be conducive to survival. So philosopher Jerry Fodor says, “Darwinian selection guarantees that organisms either know the elements of logic or become posthumous.” But this inference from Darwinian selection to true beliefs is fallacious because natural selection works on behavior not beliefs. That is, some behavior bestows on an organism a “survival-enhancing propensity,” then natural selection can prefer it. What the water buffalo believes about the lion is irrelevant as long as his behavior enhances his survival. He might believe that when he sees a lion, it’s time to migrate quickly to another area in search for food. Or he might believe that the lion is his mommy but believe falsely that the way to get her to live him is for him to run away. Notice that such a false belief will still produce behavior that confers on the water buffalo a survival advantage. The point is that any number of beliefs, most of which are wildly false, is consistent with a survival-enhancing behavior. In fact, almost any belief could be tethered to a certain behavior. As long as the behavior is conducive to survival, it is susceptible to natural selection’s invisible hand. Given such a process for the production of belief, how likely is it that any one of our beliefs is true?
…So if this naturalistic account is true, there is a remarkably low probability that any of our beliefs is true. Most simply put, natural selection working on behavior vastly undermines true belief. Since the theory itself is commended for belief, it has a component that generates skepticism. And notice that this skepticism gets turned back upon the theory itself because among those of our beliefs would be naturalism combined with the Darwinian account. So if they were true, we would have little reason to trust that our belief in them was true. So the theory naturalistically construed is self-refuting.”
(Dembski, Unapologetic Apologetics)