We investigate how locomotory behavior is generated in the brain focusing on the paradigmatic connectome of nematode Caenorhabditis elegans (C. elegans) and on neuronal and muscular activity patterns that control forward locomotion. We map the neuronal network of the worm as a multilayer network that takes into account various neurotransmitters and neuropeptides. Using logistic regression analysis, we predict the neurons of the locomotory subnetwork. Combining Hindmarsh-Rose equations for neuronal activity with a leaky integrator model for muscular activity, we study the dynamics within this subnetwork and predict the forward locomotion of the worm using a harmonic wave model. The application of time-delayed feedback control reveals synchronization patterns that contribute to a coordinated locomotion of C. elegans. Analyzing the synchronicity when the activity of certain neurons is silenced informs us about their significance for a coordinated locomotory behavior. Since the information processing is the same in humans and C. elegans, the study of the locomotory circuitry provides new insights for understanding how the brain generates motion behavior.