Rear wheel rubs frame/cage while pedaling standing up
Any bike is going to flex when you pedal
The harder you pedal the more it will flex   

So first the question is if it is flexing too much
Inspect both the wheel and frame for any damage or weakness   

If the wheel is not centered then it will rub on one side first
Make sure it is centered   

If it is centered and no excessive flex then the tire is too large
If you cannot get the tip of your pinky finger between the tire and frame then you most likely don't have enough clearance
2.1 is extra-ordinary if the bike want not built for it - that is cross
I have a pure mountain bike that tops out at 2.1