Although it is obvious that Judge Taylor must have appointed Atticus to be the defense attorney for Tom Robinson long before the beginning of the trial in Harper Lee's novel To Kill a Mockingbird, neither Jem nor Scout discovers this fact until just before the trial. Atticus previously warned his children that they may face trouble at school because of the case, but he never tells them that he was appointed as defense attorney. They first learn of his appointment in Chapter 16 when they sneak into the courthouse hallway to see the excitement first-hand:
...The conversation was about my father.
"... thinks he knows what he's doing," one said.
"Oh-h now, I wouldn't say that," said another. Atticus Finch's a deep reader, a mighty deep reader."
"... Lemme tell you somethin' now, Billy," a third said, "you know the court appointed him to defend this nigger."
"Yeah, but Atticus aims to defend him. That's what I don't like about it."
This was news, news that put a different light on things. Atticus had to, whether he wanted to or not. I thought it odd that he hadn't said anything about it--we could have used it many times defending him and ourselves.
Atticus had previously told his brother Jack in Chapter 9, but Scout apparently did not fully understand their conversation:
"Atticus, how bad is it going to be? You haven't had too much chance to discuss it."
"... I really can't tell at this stage, Jack. You know, I'd hoped to get through life without a case of this kind, but John Taylor pointed at me and said, 'You're it.' "
In the film version of the movie, this fact becomes evident much earlier, when Judge Taylor comes to Atticus's house to ask him this favor personally.