The nervous system is one of the most complex systems in the body. It can be subdivided into a central nervous system made up of the brain and the spinal cord and a second part called the peripheral nervous system made up of the rest of the nervous system outside the brain and spinal cord.
The somatic nervous system is part of the peripheral nervous system and it is responsible for the movement of voluntary muscles. It comprises of afferent and efferent nerves which transmit nerve impulses back and forth between the central nervous system and skeletal muscles, skin and sensory organs.
On the other hand, the somatosensory cortex is part of the cerebral cortex and it is located in the middle of the brain. Its main function is to process sensations or external stimuli from the environment.
So in summary, the somatosensory cortex is a component of the brain and is responsible for processing sensations or stimuli from the environment, but the somatic nervous system is not a component of the brain but a part of the peripheral nervous system responsible for transmitting impulses back and forth between the central nervous system and the skeletal muscles, skin and sensory organs.