in many countries, if not all, the hotel is required leagally to register your passport informaion to the police or some local agency as a routine procedure. It is mostly probably done behind scene (Once they did this in front of me in Italy). If staying in a privte residence place which is not in commercial nature (such as Airbnb), it is usually not required.