At the same time, endorphins, another chemical to fight stress, is released in your brain. Your endorphins main purpose is this writes researcher McGovern:
These endorphins tend to minimize the discomfort of exercise, block the feeling of pain and are even associated with a feeling of euphoria.
Overall, there is a lot going on inside our brain and it is in fact oftentimes a lot more active than when we are just sitting down or actually concentrating mentally:
Whenever I get stuck writing code, a good walk or good night’s sleep is the only thing that helps.