This is one of many phenomena that is not yet fully understood -- which does not mean that it is inexplicable, only that we don't yet know. The best thinking about this, to my knowledge, is that it's the result of something called Emergence.
If, as naturalism claims, the reasoning of the human mind is merely the product of the movement of atoms and electrons, then we have no reason to believe any of our reasoning is true.
Nor would we have any reason to be confident if a supernatural agency were responsible. The only reason for confidence in our ability to reason is its demonstrated effectiveness in the natural world. That's what science is all about.
That's-what-science-is-all-about placemarker.