This isn't exactly a thorough explanation, but basically if you multiply a matrix by its inverse, you get the identity matrix I. If you multiply any matrix by the identity matrix, you get the original matrix back again, e.g. IA = AI = A.
The theory? A guess it's things like "associative law" and "existence of the multiplicative identity"!
If you were given two numbers a, c, a not equal to 0, and told that ab= c, how would you solve for b?
If A has an inverse, then A-1(AB)= (A-1A)B= IB= B.
Notice the condition "If A has an inverse". There are plenty of different matrices, A, B, not having inverses, such that AB= 0. If A does not have an inverse, there may be many different matrices B such that AB= C.