They are there to hold the shaft from turning when installing the new ones.
Coming off requires a puller/fork tool.
The right side may need cleaning to get the 5mm key inserted.
I never use the hex. If you tap the new ones in, they hold enough to tighten the nuts.