Kind of like sitting in your seat on a plane and having someone come up with a boarding pass with the same seat number.
I always put this down to human error - whether at a hotel or on a plane. I can't believe that their computers systems don't have some sort of safeguard that indicates a room (or seat) is already occupied. Unless a human either overrides it, or hasn't properly entered it into the computer system.
Knowing that humans make mistakes, I always lock my door when in the room and I never get out of the seat when someone else claims it's theirs.