Currently when using a anvil to rename an item, it does not rename. If already renamed, and attempting to change the name, it will return to default name (and will have an NBT tag).
I had this issue was in a damaged anvil, not sure if it will happen in a normal anvil
You can do this with commands: