While Atticus does not reveal why Judge Taylor appointed him to defend Tom Robinson, Scout, who is always watching and listening to what is going on around her, learns from more than one source that the judge appointed Atticus because he thought Atticus would do his best to insure Robinson a fair trial.
Scout discovers, for instance, from listening to one of the Idlers Club members, that Judge Taylor appointed Atticus because of Atticus's integrity and competency. Later, Miss Maudie, whose word can always be trusted, says the same: the judge wanted a fair trial (as much as one could be had in the racist South) and appointed Atticus because he was a man of integrity who could be trusted to do the right thing.
We learn that despite the deep racism that runs through the white community in Maycomb, there is an undercurrent of pushback from more enlightened people who are appalled at the injustices of racism. These include the newspaper editor, Miss Maudie, and Judge Taylor—they know that the time for change has not yet come but are trying hard to plant seeds that will in the future change hearts and minds.
We also should keep in mind that much of the book's purpose is to show Scout's growing awareness of what an exemplary human being Atticus is. It is important for that reason that we know that Atticus was not chosen to defend Tom randomly, but because he was the best man for the job.