A Chinese attack submarine made an unprecedented stopover in Malaysia this week in a rare public display of China’s expanding undersea force and a further sign of power realignment in Southeast Asia.

The visit came as two Russian warships docked in the Philippines—a U.S. treaty ally—and Moscow offered to sell Manila advanced weaponry in another challenge to longstanding U.S. military relations in the region.

The...