Lee does this to illustrate a key point about racism in the book. Miss Gates brings up Hitler and how he is persecuting the Jews and how wrong she thinks that is. Now this is important because Scout tells Jem later that she overheard Miss Gates talking about how it was a good thing Tom was found guilty because it would teach them a lesson to remain in their place. When you go back and examine Miss Gates's initial lesson on Hitler, she tells the class here in America we are a democracy, unlike Germany, and we don't persecute anyone. Now given what Scout knows about Miss Gates's feelings toward African Americans, we can see the irony in her comments. We don't persecute anyone who is white. This is a key realization for Scout and it really adds to the theme of racism inherent in the novel.
Hitler is included in this chapter to show the hypocrisy of the teacher, and the confusion to understand all the differing opinions on who is persecuted and who is deserving of punishment. Scout learns of Hitler's persecution, and listens to her teacher deliver a poignant speech on the evilness of Hitler in attacking the Jews.
Yet, later Scout overhears her saying that Jim deserved what he got because the blacks did not know their place. Hitler is used to show the sympathetic nature of society at the same time the black population was still being subjected to persecution.
When Scout's teacher criticizes Hitler for his treatment of Jews, Scout is perplexed because the teacher is prejudiced against Blacks. Scout recognizes the hypocrisy of this. The US was involved in a war to end the genocide of a race, yet our own country did not have equal rights for blacks and whites. Scout recognizes this hypocrisy in the people of her own town.
I'm in 9th grade and I am already learning about this stuff. I think that Hitler is included because he is prejudice against the Jews and the white people in Maycomb County are racist against the blacks. The setting is during the 1930's too, so that should play a part in the time frame of the time Hitler was killing all of the Jews.