KARACHI, Pakistan—In April, a Pakistani mother of two blew herself up outside the gate of Karachi University’s Chinese language and culture institute, incinerating a minibus and killing three Chinese teachers and a Pakistani driver.

The attack—one of a growing number targeting Chinese nationals working abroad in Asia and Africa—was a sign of China’s deepening challenges as it pours money into the developing world with the aim of extending its influence.