Atticus says this because if he hadn't have taken the case, he would've been a hypocrite. He knew that Tom had a right to a fair trial, and if he had swayed to public opinion and neglected to give him one, he would've been going against his belief in justice.