Atticus is not generally naive about the people of his town. He knows them well and accepts them for all their failings. For instance, he knows before beginning Tom's defense that he will lose, and it is only after the jury says out so long that Atticus even begins to hope that truth will defeat racism in the courtroom. Going into Tom's trial with all the anger it arouses against him in Maycomb, Atticus wants his children to understand that those who are condemning him are their neighbors and not to be hated. Also, Atticus does not underestimate the volatile situation as Tom's trial approaches. He does, after all, station himself in front of the jail to protect Tom from whatever danger might materialize. He was not wrong to anticipate trouble; a lynch mob does come to the jail to hang Tom.
Atticus is naive, however, in one respect. He does not anticipate that anyone--not even Bob Ewell--could be so despicable as to attack and attempt to kill his children. This depth of human depravity is beyond his understanding and beyond his belief, until it happens.