Dynamics and Origin of the 2:1 Orbital Resonances of the GJ 876 Planets