How messed up are these window installs and do I need to fix them?
There are a lot of problems with that install.  But I do know that you do NOT want to nail the window frame to the rough opening on the sides.  The flanges that are nailed to the sheathing provide all of the support.  Usually there are shims underneath the window at the bottom to 1) bring the window up to the right height in the opening and 2) ensure that the bottom of the window is horizontal.  I used these windows myself.
Note that most of the movement you noticed would be prevented when the inside trim is installed, which would tie the inside of the window to the walls.
EDIT 1 - Other Shortcomings
A header, of the appropriate size for the opening, is definitely needed if the the wall is load bearing,  Even if that's not the case, I would frame the window with a minimum header just to strengthen the opening.  I notice that there is a header of sorts - two 2x4s laid on their sides. I have to defer to those with more experience as to whether this meets my &quot;minimum header&quot; need.
I would also have done the standard king-jack stub framing for the window.
There definitely should be flashing at the bottom of the rough opening, the sides, and the top of the outside of the window.  The Anderson installation instructions provide details on this, and there are lots of on-line resources you can consult also.
Finally, 20 years is not a very long time for a window.  I still have 65 year old original windows in parts of my house, and many historic structures have windows going back hundreds of years.
EDIT 2 - Added picture
Here's a picture with the low-expansion rate foam used.