Don’t move/rotate the bone. Think of the X or Z axis as your hing. That is the axis you want to rotate around. While thinking like that adjust the roll setting under the transform panel on the right hand side until the axis is aligned with how you want to rotate around.