It's not a stretch to imagine (and I think I've read social psych studies that demonstrate this, though it's so long ago I can't recall specifics) that people treat the places they "live" in differently from the places they are "visiting". This is just human nature.
(using "you" as a generic pronoun because it reads more smoothly than "one" or "that person")
If you "live" in an apartment, you don't tend to litter the hallways, because you have to see the trash yourself every day (until someone cleans it up). Your neighbors can see you, and they know where you live. There will be social pressure to conform and live in harmony with your neighbors.
If you are checking out tomorrow and will never see this place again, you are more likely to not care, say, if you dropped your ketchup drenched burger wrapper in the hallway, or accidentally put a hole in the wall on the way out, or made a little extra noise at night. This affects quality of life for your neighbors.
A lot of crime prevention is also based on knowing who your neighbors are and noticing unfamiliar faces. Again, I'm sure I can pull out statistical evidence that crime rates are lower in areas where neighbors know/recognize each other than not. Having visitors day in and day out breaks this model, and it makes crime easier to commit in that neighborhood (and the criminals don't even have to be any of the "visitors".)
The 30-day rule is arbitrarily picked (much like the 18-yr age of majority) to distinguish between the two cases of people "living" vs. "visiting" in a place. Of course there are corner cases, but a line had to be drawn somewhere, and it comes from a real desire to maintain quality of life for those people who live there (and have a stake in that community). As others have said, zoning laws exist for a reason, to keep commercial activity separated from non-commercial activity for these and many other reasons. AirBnB and the like just sidesteps that rule for profit.
Stepping back a bit, humans are social creatures. We have crawled to the top of the foot chain because we learned to live and cooperate with each other (for the most part). This is not asking to give up your kidney for your neighbor, or even giving away money or property. This is just being "neighborly", and not invite a constant stream of total strangers into the neighborhood. It's request for minimal level of cooperation for having a society. This wasn't a particularly foreign concept, even in the US. Yet, over the last few years (COVID comes to mind most prominently), I see a LOT of comments that are basically versions of "me me me! I don't care about others! I should be allowed to do what I want! My Freedom! Why should I even care about secondary/tertiary effects of my actions on others?" They scary thing is that they really seem incapable of seeing it, and perhaps, this is probably undoing of this country, as it devolves into a dystopian hellhole where everyone is only out for #1.