Mesh gets deformed after parenting with automatic weights
I think you should apply armature pose as a rest pose, what i believe happens in your case is that you have corrected the armature pose in the pose mode instead of edit mode, that way you have a non neutral pose on your armature which means as soon as you apply that armature to the mesh all bones that are not in the rest pose will apply its transformations to assigned vertices.
Hope this helps.