Tom crosses the boundaries of race and class in an extremely poignant manner. He, the black man, is supposed to be the lowest of the low, being both black and poor. Even though Mayella is poor, labelled as white trash, she is still that, white. Being white puts her above being black in the social hierarchy of the South. It's the ultimate insult that a black man, whose station in society is as low as it gets, could have the audacity to feel sorry for this white woman. And to add insult to injury, he is right to feel sorry for her. It reveals his character, a character which is not allowed for by the rhetoric of his opposers.
Because of the racism during this time, especially in the South, it was degrading for a black person to say he feels sorry for a white person. When Tom says this, he only means he was sensitive to Mayella's situation, but the racist white people took it as Tom putting himself above Mayella. This was not a sentiment that blacks could express about whites since it indicated that the black person was putting himself in a position of superiority over the white person.
Tom's "sin" is that he, a black man, could in any way feel sorry for a white woman. In the highly prejudicial town of Maycomb, this was akin to saying you were somehow superior.
You'll find this scene in Chapter 19, when Mr. Gilmer, the prosecuter, cross-examines Tom after Atticus poses his defense, near the very end of the chapter.