The title of An Enemy of the People is totally ironic. Dr. Stockmann, who gets branded with this unfortunate label, is only trying to help the people. By exposing the pollution of the Baths, he's not only protecting their health, but also protecting them from the larger scandal that will inevitably erupt when all the tourists who come to bathe in the bacteria-ridden waters start puking up green stuff.
The label of "enemy" is made even more ironic by the fact that Dr. Stockmann is popular around town at the beginning of the play. His house is always full of guests, eating, drinking, and enjoying his hospitality. When the Doctor first makes his discovery, he's even toasted as a friend of the people. The town quickly turns on him, though, when they figure out how much money it will cost to make the necessary improvements to the Baths.
In the end, Dr. Stockmann seems to almost embrace the label. He accepts the fact that he will be viewed as a heretic and a rebel. Dr. Stockmann even seems to be empowered by his outsider status, saying, "the strongest man in the world is he who stands most alone" (5.310). The title of the play might be pointing out that people who try to do the most for the world, who try to change things for the better, are often rejected at first by the majority. The Doctor isn't the first person in history to speak the truth and be punished for it.