Why can’t the generals face each other?

The two generals may share a file only if a piece stands between them. Exposing an empty file between them is an illegal move.

In this guide
The red horse is the only piece between the generals. Moving it would leave the generals facing each other.

Test the position after the move

The red horse in the diagram has the shape of several possible moves, but all would take it off the center file. None is legal because the two generals would face each other.

Look for open files in endgames

Before moving the only blocker, check both ends of the file. When moving a general sideways, check whether the destination puts it on the other general’s file with nothing in between.

Put it into practice

Sources

WXF · World Xiangqi Rules