What wins in Texas holdem a pair of kings and a pair of queens or a pair of two and a pair aces?

A pair of Aces & Deuces (Deuces = Two's) will win over a pair of Kings and Queens.

A poker hand consist out of 5 cards. The highest card(s) win of course the hand.

In this case I'm going to give you an example. Since there is no 5'th card I'll use X for it.

A pair of Aces & Deuces will look like AA22X. In this case the highest pair (or valid combination of more then 2 cards) is the Aces.

The pair of Kings & Queens looks like KKQQX. As you can see here, the highest pair (or valid combination of more then 2 cards) are the Kings.

Because the Aces are of course higher then the Kings, the hand AA22X (or Aces and Deuces) win the hand.