What you have described is a disorder known as sleep paralysis. This often frightening syndrome is characterized by an inability to perform voluntary movements at the onset, or more commonly, the offset (i.e. when you wake up) of sleep. There is an inability to move the limbs, torso or head but the ability to move the eyes and breathe remain intact. The frightening aspect is, as you describe, you are fully awake and aware of what is going on around you. Sleep paralysis usually lasts a few minutes and resolves spontaneously or by a touch or movement initiated by another person.
The exact cause is not fully known, but it probably is related to the fact that you are waking up from REM (rapid eye movement) sleep. This is the stage that most dreaming occurs. Typically the body paralyzes us during this stage so that we don’t act out our dreams and cause a danger to ourselves or our bed partner. When waking up suddenly out of REM, the paralysis somehow lingers briefly before subsiding.
There might be predisposing factors such as sleep deprivation (perhaps this occurs around finals?) or irregular sleep habits (like shift work or jet lag).
This condition actually occurs at least once in a lifetime in 40-50% of normal subjects, but occurs much less commonly as a chronic condition. The typical age of onset is during the teenage years or in the early twenties.
Sleep paralysis is not a dangerous condition, but it should be noted that sleep paralysis is part of the spectrum of disease in narcolepsy (occurs in about 60%). If you have other features of narcolepsy, such as excessive sleepiness, loss of muscle tone during periods of high emotion (called cataplexy), or hallucinations when going to sleep, you should be evaluated by a sleep specialist.