Howdy, you do have 2 pairs. You have JJ's and Ace's and he also has JJ's and Ace's however your kicker is a 10, whereas his is a 5. Hence you win. The results of each hand you have is made up of the best available hand from the 5 community and the two cards in your hand.