Why does my mesh deform when I apply an armature with automatic weights?
I have to say i'm not really good at rigging, but as none answered...  

there are a few things you need to know about armatures and bone constraints.
Your armature won't look the same in edit mode and in pose mode if you apply IK contraints. Edit mode allows to move/rotate/scale bones in rest pose so if your bones are moved in pose mode, this won't show in edit mode. Constraints are not applied in edit mode.
This applies to your IK controller bones.

So if you want to see things clearly, you have to clear the tranformations in pose mode : select all bones with A menu Pose/clear transforms/all or Alt+G, Alt+R, Alt+S.
  

Another thing to know about bones is the roll, the bone's rotation around it's main axis. To see this, go in properties panel, armature and click "Axes"

This wil show each bone's axes. This is something you need to check if you want your contraints to work as expected. You can change a bone roll with Ctrl+R in edit mode. In your case, you should use the recalculate option : in edit mode, select all bones with A, go to armature menu, Bone Roll/Recalculate Roll/Global+Y axis and see what it does.

It should fix some of your problems but you'll need to manually fix some of them. You can try some recalculate options to see what's best