As a fan of Ed McBain's 87th Precinct novels, I always wondered about the locale he called Isola, which turns out be the rough equivalent of Manhattan. Why wouldn't he just call it Manhattan and be done with it? He created a generic urban setting that never had to be true to reality, so he had the freedom to make that city fit his story needs.
This summer I met a writer who lives in England but grew up my current home of Las Cruces, New Mexico. She hated it, and her recent novel makes that clear. But she gave the town a different name, probably to spare people's feelings. All of the neighboring towns, though, kept their real names.
On the other hand, a friend wrote a novel set in Lowell, Massachusetts, and he used that name. One reader sent him a letter saying that the story was okay, but didn't he realize that his hero couldn't turn left on Dutton Street because it's one way? I also set a couple of novels in Lowell and kept worrying that someone would fault my descriptions. In my first novel, a javelina travels from near Tucson to the Grand Canyon without explanation, which is hundreds of miles. No reader questioned that, but then the whole story was meant to be nutty anyway.
Is it safer to create their own fictional towns? What do other writers do? Should your locations be real ones?