The enteric nervous system (ENS) in the walls of the gastrointestinal tract controls your bowel movements. The ENS regulates the contractions that move food through your bowels. It also regulates sphincter control using signals the brain and spinal cord generate.
Other nerves that support bowel movement function are the cauda equina at the bottom of your spinal cord and the pudendal nerve in the back of your pelvis.