Mr. Underwood is protecting Atticus when he holds the gun on the mob.
Although Mr. Underwood “despises Negroes” (Ch. 16), he cares about Atticus. He does not say that he was protecting Tom. He was protecting his friend.
Mr. Underwood had no use for any organization but The Maycomb Tribune, of which he was the sole owner, editor, and printer. ... He rarely gathered news; people brought it to him. (Ch. 15)
When the mob leaves, Atticus tells Tom that the men are no longer a threat. It is then revealed that Mr. Underwood has been covering them with a shotgun the whole time, ready to come to their rescue if they needed it.
From a different direction, another voice cut crisply through the night: "You're damn tootin' they won't. Had you covered all the time, Atticus." (Ch. 15)
Mr. Underwood’s feelings about Negroes aside, he has a strong sense of justice. He may be a drunk and mean, but he is also an important man in the town because he runs the paper. He is respected. Atticus is already beginning to change feelings. If the fact that he is loved and respected can help someone like Mr. Underwood change his ways, even a little, there is hope for the rest of the town.
Mr. Underwood, who "despises Negroes...won't have one near him" (Ch. 16) does not necessarily believe in gratuitous cruelty to them or in breaking the law in order to do them harm.
Named after a Confederate general, Braxton Bragg, who was an advisor to Jefferson Davis, Mr. Underwood is a highly intelligent and educated man who runs the local newspaper office. As a legitimate and ethical journalist, Mr. Underwood surely knows the value of the rule of law. So, when he keeps an eye on Atticus Finch on the night that Atticus guards the door to the cell of Tom Robinson, Mr. Underwood anticipates a lynch mob and is determined that injustice not occur. From his open window, Mr. Underwood points his shotgun when a mob appears. After this mob departs, Braxton Underwood has a long talk with Atticus.
Further, after the travesty of a trial for Tom Robinson, Mr. Underwood writes a scathing editorial that is an invective against the injustice dealt by the jury.
Mr. Underwood simply figured it was a sin to kill cripples, be they standing, sitting, or escaping. He likened Tom's death to the senseless slaughter of songbirds by hunters and children.
He may "despise Negroes," but Mr. Underwood has ethics and he believes in justice.