This always makes me laugh. A lot of hotel regulation was written with fire safety in mind (large building with a lot of small rooms in it and a high number of occupants). But AirBnBs... are just regular apartments so they don't break the fire safety rules (if the appartment is zoned for two occupants, really you aren't breaking any laws by housing two guests).
The rest is simply NIMBY and cities trying to fleece tourists really. Or bureaucrats trying to justify the red tape and regulation that keeps them employed.
EDIT: Wow, I see the downvotes yet no explanations!