We meet Mrs. Henry Lafayette Dubose in chapter eleven of Harper Lee's To Kill a Mockingbird, and it is not a particularly pleasant meeting. The old woman is cranky and cruel as she sits on her porch and viciously insults all of the Finches every time they pass by her.
Of course we know that Jem loses his temper one day and damages some of Mrs. Dubose's flowers. As a punishment, Jem has to go and read to the old lady, and that is not a pleasant task, either. Later we learn that the old woman was addicted to morphine as a painkiller and determined to break free of the addiction before she died.
The answer to your question about why the author included Mrs. Dubose in the novel comes from Atticus as he is talking to Jem after Mrs. Dubose died. It is interesting to note that this chapter on Mrs. Dubose follows the chapter in which Atticus demonstrated courage by facing down a rabid dog in the middle of the street. While this is one kind of courage, Atticus wants his children, and Jem in particular, to understand about other kinds of courage. Atticus says:
"I wanted you to see something about her—I wanted you to see what real courage is, instead of getting the idea that courage is a man with a gun in his hand. It’s when you know you’re licked before you begin but you begin anyway and you see it through no matter what. You rarely win, but sometimes you do. Mrs. Dubose won, all ninety-eight pounds of her. According to her views, she died beholden to nothing and nobody. She was the bravest person I ever knew.”
Harper Lee includes this episode with Mrs. Dubose as part of an ongoing theme expressed in the novel, again through Atticus. In chapter three, he explains to Scout that
"[y]ou never really understand a person until you consider things from his point of view […] until you climb into his skin and walk around in it."
Jem's encounter with Mrs. Dubose is designed to teach him this same lesson. There was a reason for the woman's crankiness and bad behavior, something neither Jem nor Scout could see but which Atticus was able to understand--and even overlook--because he saw things from Mrs. Dubose's point of view. Though it is not clear that Scout understood all of this, Jem is moved by the lesson.