I heard that the northern lights are visible from the town
Your very best chance of seeing the northern lights is actually out of the window of your airplane, assuming you'll be in the air during hours of darkness - that should be true at some point provided it isn't too early in September - amount of darkness changes very fast in September. So try to get a window seat on the side of the plane looking north during hours of darkness. It would help to have a piece of thick dark material, eg a heavy coat, to cover your head so you can look out of the window without being disturbed by the cabin lights.
The best chance of seeing northern lights on the ground is from places that are dark, not from town, you need to get away from streetlights. But because Keflavik town is a small town, you probably wouldn't have to get very far away, as the extent of the light pollution would be relatively small. But you can only see them if the sky is clear and they are on. So you'd need a lot of luck. If skies were clear, without which you have no chance, maybe you could just tell a taxi driver to take you a short distance somewhere dark and come and get you later when you are chilled to the bone, for the lights tend to appear only for occasional periods of 20mins or so, and thus you need a decent period of time to wait and hope they appear. But I doubt you'd have a nearby hostelry to retreat to. Keflavik town isn't really a night-life town, it's a working/dormitory place, and there's a handful of restaurants such as you'd find in such a town. For example, you could probably find sufficient darkness by a short walk from Hotel Berg on the N edge of Keflavik town. But nearby restaurant Kaffi Duus shuts at 10pm and Hotel Berg just does bed and breakfast. Even the Icelandair Hotel (shown on Google maps under its old name Flughotel) shuts its bar at 23.00, and you'd have a longer walk to somewhere dark from there, Hotel Keflavik similarly.