Of course it can be very upsetting to see your child rocking in the corner, especially if they're being withdrawn or shying away from other children. Now what's important to know is perhaps it's not a big deal. Perhaps they are rocking in the corner because they're playing a game. Perhaps they're trying to self-soothe and need some comfort. Depending on the age of your child, it can be a problem, or it can be a cause for concern.
If your child is constantly withdrawing from their peers and instead going into the corner because it's too much for them, that is cause for concern. If you're seeing this type of behavior over and over again and it appears to be somewhat of a pattern, it is something that should be addressed with your child's pediatrician.
One thing could be that it's too much input for them. It might be too many people, too much noises, too many stimuli around for them, and they need a place to be away from that and quiet and be able to comfort themselves. Now in some ways, it's good that they're able to withdraw and know that they need to be in a quiet place, but in another sense we need to be able to address those issues so that they can come back to the group and play with their peers in an age-appropriate manner.
So the best thing to do would be to monitor, observe your child's behavior. Track it. Write down when you're seeing, what you're seeing, and how your child responds to you when you're coming over to them. And then to discuss it with your child's pediatrician so that they can guide you in the right direction.