Because Spain's high unemployment, in particular youth unemployment and the construction sector, actions that reduce tourism lead to fewer jobs and less income flowing into the city.
I'm not against the measure (last time in Barcelona I was in a hotel and my friends rented an AirBnB apartment instead; they had fun and I had to move hotel rooms because the guy above me flooded the bathtub), and excessive tourism (Barcelona, Edinburgh, Amsterdam all suffer from it) is annoying even putting housing prices and lack of availability to the side, but I just wonder.