We don't see absolute colours and darkness/lightness. We see relative ones. Something is dark when it is compared with light.
So square B is light, because there are dark squares around it. Square A is light because there are dark squares around it.
The fact that they are both the same colours doesn't matter. Our eyes, or rather brains, are blind to that. We don't measure, we compare.