We believe deeply in our own free will. I decide to walk through the doorway and I do, as simple as that. But from a scientific point of view, free will is extremely puzzling. For science, what we do results from the causal chain of events in our brains and minds. Where does free will fit in?

But if free will doesn’t exist, why do we believe so strongly that it does? Where does that belief come from? In a new study in the journal Cognition, my colleagues and I tried to find out by looking at what children think about free will. When and how do our ideas about freedom develop?

Philosophers point out that there are different versions of free will. A simple version holds that we exercise our free will when we aren’t constrained by outside forces. If the door were locked, I couldn’t walk through it, no matter how determined I was. But since it’s open, I can choose to go through or not. Saying that we act freely is just saying that we can do what we want when we aren’t controlled by outside forces. This poses no problem for science. This version simply says that my actions usually stem from events in my brain—not from the world outside it.

But we also think that we have free will in a stronger sense. We aren’t just free from outside constraints; we can even act against our own desires. I might want the cookie, believe that the cookie is delicious, think that the cookie is healthy. But at the last moment, as a pure act of will, I could simply choose not to eat the cookie.

In fact, I can even freely choose to act perversely. In Dostoyevsky’s “Crime and Punishment,” Raskolnikov murders an old woman—a stupid, brutal, unnecessary crime—just to show that he truly has free will. This idea of pure autonomy is more difficult to reconcile with the scientific view that our actions are always caused by the events in our minds and brains.

Click for more from The Wall Street Journal.