When simulating your arm in Gazebo, the wrist joint connecting the lower arm to the hand is acting as a constraint on the movement, only allowing it to rotate in one axis (Y axis). It sounds like you would like a "ball joint" behavior, which is a constraint on all translation DOF, but all the rotation DOF can rotate freely.