Check all four possibilities

The circuit follows the same two steps every time:

1. NOT flips B.
2. AND checks whether A and the flipped B are both 1.

Look at all four input pairs.

Only A=1, B=0 gives AND two 1s. That is also the only case where A is bigger.

The circuit works.