If you have 2 of the same item, one of which in enchanted, switching directly between the two will still look like whichever one you selected first.
In the first image, I am holding an enchanted gold sword.
In the second image, I have swapped from the enchanted one to the normal one without selecting any other hotbar slots.
Note that this bug doesn't happen in third person.
It also works the other way around, where selecting an unenchanted item then selecting an enchanted item doesn't show the enchanted texture.
MC-59579 Held items don't change when swapped with another item with the same ID