The Royals had runners on first and second with nobody out in the seventh when George Kottaras put down a bunt in front of the plate. Anderson quickly jumped on the ball, but his throw to first sailed over the head of Paul Konerko and Maxwell easily scored from second to snap a 2-2 tie.
Kansas City's other two runs came on a homer by David Lough in the fourth. Chicago came up with solo shots from Konerko in the second and Adam Dunn in the sixth. It was Dunn's 33rd of the year.
Royals starter Jeremy Guthrie (15-12) survived seven innings to get the win, giving up the two home runs and two other hits. Greg Holland survived a two-out single in the ninth on the way to his 46th save.
Andre Rienzi (2-3) allowed three runs, one of them unearned, in six-plus innings to absorb the loss.
Jessica Simpson shares three-way kiss with friends in photo
Susan Sarandon 'very excited' about daughter's pregnancy