Believing What We Do Not Believe: Acquiescence to Superstitious Beliefs and Other Powerful Intuitions, Jane Risen looks at this question from the perspective of dual process models such as Kahneman's model distinguishing system 1 and 2 thinking.
System 1 processes information automatically, fast, and imprecisely; system 2 processes information consciously, slowly, and more precisely.
Kahneman explains that system 2 is necessary for correcting mistakes made by system 1. Jane Risen suggests that system 2, after detecting a mistake can also do something else than to correct a mistake, namely to rationalize it. This means making up reasons for why the belief may not be wrong after all.
This reminds me of cognitive dissonance theory by Leon Festinger. This is about the phenomenon that a conflict between certain beliefs on the one hand and certain behaviors or fact on the other hand creates a psychological tension which we want to reduce. Festinger noticed that we usually do not change our beliefs about reality but instead invent reasons which make it possible to hold on to them such as unconsciously changing our behavior or our memory of what happened.
You might wonder why we just don't change our beliefs if logic and evidence contradict them. To understand that you can read this recent article: 4 factors which impede change of beliefs. This is how it can happen that otherwise intelligent people can keep believing in thing that are evidently not true.