From Bulbapedia, the community-driven Pokémon encyclopedia.
The Choice item lock glitch is present in the core series Generation V, VI, and VII games. It has different effects in each generation.
It restricts the moves a Pokémon can use even when it it no longer holding a Choice item (the Choice Band, Choice Specs, or Choice Scarf).
If a Pokémon is already locked into a move due to a Choice item, if the held Choice item is removed while the effect of the Pokémon's held item is negated (by Klutz, Embargo, or Magic Room), the Pokémon will remain locked into the move. A Pokémon cannot become locked into a move via a held Choice item while its item is negated; this only occurs if it was locked into a move before its item had its effect negated.
When the Pokémon's held item regains its effect (e.g. Magic Room wears off), as long as the Pokémon has a held item—regardless of what the held item is—the Pokémon cannot select moves other than the one it is locked into; if it attempts to select another move, the message "The <HELD ITEM> only allows the use of <MOVE>!" will be displayed ("The <HELD ITEM> allows the use of only <MOVE>!" in Generation V).
In Generation V, this also applies if it has no held item, with "None" being displayed in place of the name of the held item. In Generation VI and VII, this glitch does not affect the Pokémon's ability to choose moves while it has no held item.
In Generation VII, if a Pokémon is already locked into a move due to a Choice item, if the Pokémon would use a move other than the move it is locked into, that move will now fail. This new mechanic introduces new related glitches.
If a Pokémon is already locked into a move due to a Choice item, if the effect of its held item is negated (by Klutz, Embargo, or Magic Room), it is free to select any move it wants, but moves other than the move it is locked into fail.
Likewise, if the Pokémon no longer holds a Choice item but is still locked into a move due to the glitch mentioned earlier, moves other than the move it is locked into will fail. Therefore, even though having no held item while locked into a move does not restrict the moves a Pokémon can choose in Generation VII, all moves other than the move it is locked into will fail.