Yes in most states it's illegal to drive around in town with your bright headlights on.
When you approach a town from a highway you're supposed to dim your headlights upon entering that town as having your bright headlights on along with the other vehicles lights and the street lights can blind you and other drivers.
So when you come upon a town or are driving in town then turn your bright headlights off and keep only the dim headlights on when in town.
Also when you're approaching another vehicle on the highway or road dim your headlights if you have them on bright even if the other driver doesn't dim their headlights as it can blind you and the other driver if you both drive with your bright headlights on.