Part of Ibsen's reason for writing An Enemy of the People was the hostile reception of his previous play Ghosts. Ibsen believed that the public had failed to make any distinction between the firefighter and the fire, treating the man who discussed unpleasant truths in order to resolve them as though he were responsible for their existence.
In An Enemy of the People, Ibsen creates two brothers who are polar opposites. Dr. Thomas Stockmann is conscientious, public-spirited, intelligent, and perhaps rather arrogant, though his self-confidence is backed-up with genuine ability. He is guided by his own moral compass, rather than taking the most convenient path. His brother, Peter, is slow-witted, conventional, and authoritarian, exasperated by what he sees as his brother's recalcitrance and disobedience. He is unscrupulous in his pursuit of power and popularity.
Ibsen is making the point that ordinary people cannot discern who is their enemy, and automatically assume that it is the person who challenges them. Dr. Stockmann's decision to expose the contamination of the water supply is bad for the economy of the town, and appears in the short term to harm the people. Dr. Stockmann is far-sighted enough to see that he is doing the right thing, but he does not realize that few other people will share his perspective. Peter, though less intelligent than his brother, has an instinct for populism and tells people what they want to hear. His comforting falsehoods make him the true enemy of the people, but the people themselves will never recognize this until it is too late.