what causes sleep paralysis

During rapid eye movement (REM) sleep the brain has vivid dreams, while the muscles of the body are essentially turned off. While sleeping, the muscles are unable to move so that the person won’t be able to act out dreams with their body

Sleep paralysis happens when a person wakes up before REM is finished. The person will be conscious, but the body’s ability to move hasn’t been turned back on yet