Three possibilities come to mind:

Is there an evolutionary purpose?

Does it arise as a consequence of our mental activities, a sort of side effect of our thinking?

Is it given a priori (something we have to think in order to think at all)?