You're free to do what you want in your home, to the extent that it does not violate certain laws including zoning laws. You probably wouldn't want somebody running a restaurant out of the house or apartment next door to you because of the large impact that such a business could have on neighbors. Similarly, AirBnB rentals are frequently run as de facto hotels and can have a very large impact on neighbors, and the neighbors don't have anybody with a stake in the matter to complain to if the property owner or leaseholder is not residing on the premises at the time. This law, and similar laws are being enacted all over the country, are aimed at ensuring residential properties are residential.
Your specific complaints seems to be linked to you're misunderstanding of the law. It is stated in the summary above to exempt situations where the owner or lease-holder is residing on the premises during the short-term rental. A friend staying over is not a rental and thus not a problem.