Ouch. You have to break baby's (super-strong) suction before taking her off of your breast. To do this, simply slide your fingertip between her gums. You'll feel (and probably hear) when the suction is broken.
Pulling baby off without breaking suction can be super-painful (as you've probably learned) and potentially damaging to your nipple, so don't do it.