I have a mesh and I have an armature that I placed within the mesh. I select the mesh, I select the armature whilst holding shift, then I do a Ctrl+P to attach the armature. I click Armature Deform with Automatic Weights, and suddenly my entire mesh decides it needs to be somewhere else and moves to some new location--the bones are no longer within as they remain where they were. What gives? Why is my mesh moving away from the bones?
To fix this follow the below steps:
1- Select your armature and hit ctrl+A
2- Hit Apply Rotation
3- Do step 1 again and hit Apply Scale then again and Apply Location
4- Select your mesh and do steps from 1-3 again.
5- Voila, it will work :)