I had to take some time to decide on my choices.
For the Union, I think George Thomas is the most underrated, for the
reasons another poster has mentioned. The South hated him because he
was a native Virginian who turned "traitor." The North distrusted
him for the same reason.
For the Confederacy, and this was the hard one, I nominate Richard
Anderson. There was nothing flamboyant about Anderson, but there was
competence and reliability. If Lee or Longstreet told him to have
his troops do something, it got done. Of course, he was in the wrong
theatre. I think he has been underrated because quiet competence
doesn't get the recognition that boldness (aka Stonewall and JEB
Stuart) does. Also, after the war, Anderson faded into the total
obscurity of the poverty that befell most of the Confederacy.
Anderson's troops did well at Antietam until he was wounded, and his
second in command Roger Pryor had to take over. Pryor was a
politician-general without military training, though he tried to
train himself, he just didn't have the natural abilities. The ironic
trivia about Pryor is that he is the only General who became a
private. When Davis (in one of his few wise decisions) would not
give Pryor a fighting brigade, Pryor (nicknamed "Harry Hotspur")
resigned his commission and re-enlisted in Fitzhugh Lee's cavalry as
a private. He worked primarily as a scout and surprisingly, performed
extremely well in that role. Just not a leader. Carole