Why is mesh moving out of place while weight painting?
This is because your armature is not in its rest pose. As you add vertices to a bone, they will begin to be deformed by the bone you're adding them to. Since that bone is in a deformed position, the vertices have to move because they're beginning to be deformed by that bone (as you add weight to them).

To solve this problem, you want to set the rest position of your armature so that as you add weight to a vertex, it's not being deformed by the bone you're adding it to (because the bone hasn't yet moved from its default position).

The best way to do this is in edit mode for the armature. While in edit mode (the bones should be orange, not blue), you need to move all the bones in the positions they are in the picture you posted. Then, in pose mode (the bones should be blue), you need to clear all transforms. This makes it so that there's no deformation to be applied as you add vertices to a bone. The vertices will still be deformed when the bone does move... it just hasn't moved yet.