I've been remembering a lot of my dreams this month and in the spirit of full disclosure, I will tell you about them in all their random details! But first some fun facts. Humans dream during REM sleep, named after its "rapid eye movement", the stage of sleep most closely resembling wakeful neural activity. Various theories have been proposed for the regenerative functionality of REM sleep. Indeed, sleep deprived individuals and people trying out polyphasic sleep get less REM sleep, as the body favours the deeper stages in those circumstances. The image below, called a hypnogram, shows how the stages normally occur.
There are four or five cycles of REM sleep and they last for longer and longer amounts of time until the person wakes up. Movement of the eyes is presumably related to the fact that someone in a dream state feels mentally alert. I suppose the reason for the entire body not moving is the protection mechanism you hear about - where the body is physiologically immobilized during sleep. Even though this is supposed to wear off quickly upon regaining consciousness, some people report "glitches" where they wake up in total paralysis for several minutes. This has never happened to me but I think it would be really cool!