XOR is an operation that can always be reversed, all information is retained. It is as simple as that. Using AND and OR may result into information loss because you cannot tell if certain bits were either 1 or 0 in the operands.
Playing a little with the python repl, we will use 19 (
10011) and 5 (
101) since these numbers make for good examples.
Using OR you lose the information about which of the operands had a certain bit on:
Isn't that 19? Yep, that's 19. The resulting number cannot tell us that it has been ORed with 5.
Using AND is the same:
That's 1. There is not way for us to recover neither number (19 or 5) easily, we lost information again.
XOR is good for cryptographical tools because you do not lose information when XORing:
That's 22. Apparently that does not tell us much, but see this:
You can recover either number by XORing the 22 with the other number. That's a very primitive conception of a secret key. Assuming that you and someone else can have a huge list of very big and random numbers (both of you have the same numbers), you can simply XOR messages and then securely exchange between yourselves. As long as you guys use a different number every time you communicate that is a secure algorithm. The algorithm is called an one-time pad.