ISLAMABAD—Pakistan’s ruling power structure has long been summed up with the saying “Allah, Army and America.”

China is now staking a claim to supplanting the U.S. with tens of billions of dollars of investment, an embrace that promises Pakistan economic benefits and saddles it with debt—ensuring the relationship will last.

Chinese President...