Hahahaha, don't be afraid. It's called a nightmare. It's just that your brain is partially awake, but you're not fully awake. You can't completely control your body. It usually recovers in a few minutes.
This is not a harmful symptom, most people have experienced it. Regular sleep will reduce this situation.