humans sleepwalk due to a missing chemical or brain segment or something which causes your body to relax completely. the absence of the same thing is what causes sleep paralysis. This can be a pretty permanent situation or just an occasional thing. information was gathered from random vsauce videos watched years ago.
edit: I explained this pretty badly. the chemical causes you to relax. the absence causes you to enact your dreams. the presence at the wrong times can result in sleep paralysis.