I recently learned this as I have been removing Insteon out of my network and replacing it with Zigbee. It happened twice to me and then I started really trying to figure out what was going on and was able to easily.
The scenario is that I have a light, say light.couch, and want to replace it. What I normally do is rename that entity to something like light.couch_removed so I can name the replacement as light.couch. What I kept running into is that I rename the old one without any problems and when I try to name the new one it tells me there is already an entity with that name. When I go into devices/entities I can, indeed, see that I have TWO now, one called light.couch_removed and light.couch - one is integration (Insteon) and the other is not but it is not configurable nor can it be removed.
The first time I just changed the name on the new device entirely and redid all my automations and scripts and groups for the new name. This time around it was a “more important” switch that would require a significant amount of re-coding so I dug in deeper and wondered if it had anything to do with HomeKit and, low and behold, it does.
Once I edited my HomeKit config and commented out light.couch and reloaded the yaml through dev tools, the phantom light.couch went away, I was able to name my new device to that name, uncomment my commented HomeKit config lines, reload the HomeKit yaml and all was right in the world.
This is just a public service announcement in case someone else runs into this issue they know the solution.