Tom was in a very unfortunate position. He was a black man, who, at that time, was the lowest on the social totem pole. Yet, here is a white woman who was coming on to him, expressing her loneliness and her desire to be with him. Mayella probably thought that it was an easy situation; she might have thought that because Tom was a black man, that he would be flattered at her attentions, and be all for it. There was no possible way a black man would reject her. So, when he rejects her, she is doubly offended. She is offended first of all, because he is a man who is rejecting her. That hurts. But then, of all things, he is a black man rejecting her. Of all the nerve! He should be grateful to be considered worthy of attention! At least, that is possibly her viewpoint.
So Tom, no matter what, is in a bad situation. If he accepts her advances, he is being unfaithful to his wife, breaking social norms and rules of "propriety", and runs the risk of being caught. If caught, he will for sure be the one seen as the perpetrator while she gets off clean. But, if he rejects her, then she is offended, hurt, and might react defensively and dangerously. When Bob comes on the scene, he doesn't jump to conclusions; he realizes his daughter has come on to Tom, but is so horrified by the social indecency of this that he concocts the story of rape anyway, Tom IS accused, DOES take the blame, and Mayella uses her hurt against him. He gets the worst of both situations there.
I hope this helps to explain the subtlety of the situation a bit; Tom did the right thing, but Bob and Mayella's wounded pride are the unfortunate catalyst to Tom's suffering consequences for a crime that he never committed. Good luck!