My mental model is that the brain has some kind of pseudorandom idea generator. Like any pseudorandom generator, it needs a wide array of inputs. I bet walking around provides all kinds of muscular and sensory inputs, as well as increased blood flow and engagement of most parts of the brain which is precisely what is required for pseudorandom creativity.