For the same reason that cities offer tax incentives to companies to locate there.Movies are a little different, because they are obviously not permanent (ie you shoot for a week, month, months, you are done), but there is a shot in the arm there, for catering, equipment rentals, background actors, hotels, and so forth people mentioned. Also, if you attract a film shoot there and then that gets others to think of it, you build up a cottage industry, video and film equipment rentals, lighting, other services, that cater to the film industry, and it becomes something that starts feeding itself. NYC has done that for years, with tv and video production, and there are whole businesses that make their living with film and tv and music video production, studios like Kaufman Astoria Studios, other studios in the old Brooklyn Navy yard, and so forth.
Then, too, there is prestige, having movie X (Let’s say Spiderman) shoot in your town/city becomes a tourism point. There is a whole industry in NYC where they take all these people out of town to see the locations where “Sex and the City” were filmed,for example. It is like getting a company to locate there, Atlanta proudly proclaims itself the headquarters of Coca Cola, Home Depot, NYC talks about the many corporate headquarters there, and so forth.
The basic idea is that any benefit the town pays for in terms of for example lowering the taxes the production company pays, supplying advisors and such, police protection, is more than made up for in new revenue. Sometimes that is true, other times locations get hosed, but for the most part they are willing to take that risk. Put it this way, compared to city build stadiums and such, this is a lot more lucrative for the towns and cities, sports stadiums end up costing cities money and rarely if ever provide the benefits they claim.