B, as can be seen from the figure, the positions of the two cars are changing, so train A is the reference, and train B must be moving, so b is correct;
C as can be seen from the figure, the positions of the two cars are changing. Taking train B as a reference, train A must be moving, so C is wrong;
D. Taking the ground as a reference, two trains may be moving, or one train may be stationary, so D is wrong.
So choose B.