why does my workbench twist?
Triangulation is the answer here. The flex and twisting that you see is due to the fact that the rectangles formed by the legs, top and shelf supports are able to parallelogram easily. The long lever arms of the legs are easily able to distort the joints you created even with two screws. 

There are a number of methods you could use to correct the problems.


You could use more of the 2x2 material to create angle members from one top corner of each of the rectangles to the opposite bottom corner. If properly secured at the ends the angle member can resist the racking that is currently happening. One angle member works for racking in both directions because the 2x2 material can work up in both a compression mode and an extension pull mode. You may want to avoid adding an angle brace across the front because it would impede the use of the shelf even though it would add additional bracing to the table. 
You could cover some of the rectangle surfaces with a thin sheet material like plywood, Masonite  or OSB. This would significantly reduce any racking that occurs in that rectangle. Of course you have to attach this material at multiple points around its periphery. Material on the back and sides should be more than sufficient. One suggestion would be to use peg board material for these sides as you could utilize those surfaces for hanging things.
Another solution that can be used is to use thin steel banding material to create the triangulation. Since such material is only effective in an extension stress mode you would need to apply two such bands on each rectangle surface as a large X across the corners. This material is often available in a roll that has holes at regular intervals along its length (a.k.a, plumbers strapping) that could be very easy to add to your existing structure by using short screws to attach it to the wood members in each corner. 


With any of these ideas you want to make sure to use a framing square to ensure that the leg structures are at right angles to the top before securing the braces, panels or banding.