Hand A: Ace of Spades, Jack of Hearts
Hand B: Four of Hearts, Four of Diamonds.
River: Eight of Diamonds, Seven of Hearts, Eight of Spades, Ten of Clubs, Ten of Spades.
Why does Hand A win?
In Texas Holdem, you combine your hole cards (the two you've been dealt) together with the five community cards, the "board", and make the best five card hand that you can. This is key - you can only choose up to five cards to make your hand.
The pair of fours that Hand B has been dealt is counterfeited by the board - that is, there are two higher pairs (two eights and two tens) on the board, so the best hand that player B can make is those two pairs (since a pair of fours is lower than either of those pairs) plus a kicker, used as a tie-breaker. Since the highest kicker player B can choose is the 7 on the board, player B's hand is just:
(Using the notation: s = spades, h = hearts, c = clubs, d = diamonds, T = ten, J = jack, Q = queen, K = king, A = ace.)
Ts, Tc, 8s, 8d, 7h
Since A has a higher kicker, the ace of spades (one of A's hole cards), player A's best hand is:
Ts, Tc, 8s, 8d, As
Since Ace is higher than 7, A wins because their kicker is higher.