Both men do what is right regardless of possible negative consequences from their society. As Emerson urged, they act on the dictates of their consciences. Emerson wrote,
Society everywhere is in conspiracy against the manhood of every one of its members. Society is a joint-stock company in which the members agreee for the better securing of his bread to each shareholder, to surrender the liberty and culture of the eater. The virtue in most request is conformity. Self-reliance is its aversion.....Nothing is at last sacred but the integrity of your own mind.
Knowing that "it is a sin to kill a mockingbird," Atticus agrees to defend Tom Robinson despite his realization that "Maycomb's disease" will have him labeled as a "n---lover." He tells his brother Jack that he could not refuse to take the case when appointed to do so: "But do you think I could face my children otherwise?"
Similarly, Tom Robinson, despite having been unjustly convicted by the town in the past of an offense and having had to serve jail time, still helps the Ewell girl from the kindness and charity of his heart. He chops wood for her or carries water because "Mr. Ewell didn't seem to help her none, and neither did the chillun, and I knowed she didn't have no nickel to spare."
Indeed, both men knew what Emerson wrote: "Nothing is at last sacred but the integrity of your mind."