In insects like the cockroach the brain is distributed, i.e. some parts lie in the head and some in the abdominal cavity. Which part is responsible for controlling locomotion?
Technically speaking, locomotion is actually not produced by the brain in cockroaches; there are neurological controllers in the legs themselves which produce locomotion even when contact with centralized nervous system is severed.
I include this for reference, because it was not explicitly stated in your question. However, I believe it was intended to be implied by the phrase "responsible for controlling." In other words, from my understanding, you're more interested in what section of the brain actually controls those actions in a normal cockroach.
From Central Nervous Control of Cockroach Walking by Charles R. Froutner, you can see even just in the abstract that the movements became spontaneous when the connection with the segmental ganglion was broken, showing that this is very likely where the control is exerted. (The segmental ganglion, for reference, is a part of the dorsal "brain" you made reference to.)
Just to be clear, the brain is not distributed, it is the thoracic ganglia present in thorax that aid an arthropod for different tasks.
Arthropods have most of their sensory stimuli and motor actions controlled by Midline Brain Neurophils, called Central Complex (CC)
Quoting Journal of Experimental Biology >>
Previous studies have also linked the CC to motor actions. Huber showed that stimulation within the CC enhances locomotor activity (Huber, 1960). More recently, electrophysiology studies showed that the neural activity of some CC units is correlated with, and often precedes, changes in stepping frequency.