So if I plug in a black and white image to the fac of the mix shader node, what is happening? What's the difference between when A and B is connected to each socket and when A and B is switched to the other socket(basically switching two lines of wires each other)?
When you connect a BW image into the FAC input of the Mix Shader:
Black areas mean A
White areas mean B
When using the FAC slider:
0 means A
1 means B
For all nodes (roughness, metalness, fac...)
Black means 0, white means 1.
You can use gradual transition as well.