It is a basic police requirements on most countries. Hotels must collect visitor id's and keep it for several weeks.
Not in my, admittedly limited, experience. I've stayed in hotels in at least a dozen countries and under half of them wanted my passport. In the UK it's usually enough to just say my name to the receptionist, they confirm how long I'm staying, ask me to sign a form and tell them my car registration number and then they hand me the key. Quite often there isn't even a form to sign, just a terminal to enter my car registration number to avoid parking fees.
I was asked for my passport in a Premier Inn this summer because they thought I was a foreigner but when I pointed out that I was a UK citizen they dropped the requirement.
In Europe it was mostly Italy and Poland that wanted to see my passport.
The requirement is that they provide some of the information contained in the visitor's id to a police web application. At least, that's how it works here in Spain. But it doesn't mean the hotel needs to take a picture of your id, nor scan it. They just need to transcribe the required information. Yet some would not let you check-in if you refuse to let them scan your id or take pictures of it, that you never know how and for how long will be kept. Of course, you usually don't want to argue after you arrive at some place to make the check-in when the alternative is to sleep on the street.
I politely refused the data collection a couple times just to confirm my understanding, expecting to trigger some discussion in case I was wrong. But hotel staff was perfectly aware of the applicable local rules and just skipped ahead to explaining the most convenient route to my room. Apparently the general assumption among visitors is that they would not ask if they were not required to collect it.
Yeah, it's old-school people control. This said, these days it could be done electronically, without the hotel storing physical information: at check-in, you put your passport in goverment-issued, (hopefully) tamper-proof machines, the hotel confirms length of stay, police server gets the info and that's it; early checkouts, the hotel must notify via some web portal. It would be relatively easy to implement.
But nobody really cares enough to spend money modernising this sort of system.