They are 12 equations in 8 unknowns. There are solutions to 11 of the equations, but not to all of them:
A = {{1, 2}, {3, 4}};
B = {{5, 6}, {7, 8}};
U = {{9, 10}, {11, 12}};
X = Array[x, Dimensions[A]];
Y = Array[y, Dimensions[B]];
eqs = Thread[Flatten[{A . X - X . A, B . Y - Y . B, U - X . Y}] == 0]
Solve[Take[eqs, 11]]
Solve[eqs]