Today, if you take the red-eye flight from Shanghai to Addis Ababa, the Ethiopian capital, chances are you’ll be seated among Chinese workers heading to a construction site in oil-rich Equatorial Guinea, a cotton-processing plant in Mozambique, a telecom project in Nigeria. China’s trade with African nations has increased fortyfold in the past 20 years. The workers and migrants carrying out China’s global vision are now so ubiquitous in Africa — as many as a million of them, according to one estimate — that when my wife and I wandered into a Hunanese restaurant in Addis, the red-faced workers devouring twice-cooked pork blurted out: “Ah, laowai laile!” “Foreigners have come!” It seemed rude to point out that they were foreigners, too.

China’s advances have come as the West seems to be retreating. United States engagement in Asia, Africa and Latin America declined after the Cold War, when the regions served as proxies for superpower rivalries. China’s rise and the wars in the Middle East also pulled away resources and attention. And now, with Washington raising doubts about global agreements on issues like free trade and climate change, Beijing has more leverage to push its own initiatives and show its capacity for global leadership. President Trump’s disdain for the Trans-Pacific Partnership has already made Beijing’s trade proposals, which exclude the United States, more appealing. “In certain parts of the world, the relative inattention of the Trump administration is definitely creating an opening for China to fill,” says David Shambaugh, director of the China Policy Program at George Washington University and author of the 2013 book “China Goes Global.” But “China remains very much a partial power — and only offers other countries an economic relationship.”

Still, for a nation like Namibia, China’s pitches can be irresistible partly because they’re rooted in historical solidarity. Beijing backed the black nationalist movement’s liberation struggle against apartheid and its white South African overlords. Sam Nujoma, the leader of the South West Africa People’s Organization (Swapo), visited Beijing in search of guns and funds in the early 1960s. When Namibia finally claimed independence in early 1990, with Nujoma as president, China became one of its first diplomatic allies, pronouncing the two countries “all-weather friends.” (Beijing was also desperate for allies to break its diplomatic isolation after its violent crackdown on the 1989 democracy movement.)

In addition to offering its own history as a model for climbing out of poverty, China provides no-strings financing that, unlike Western aid, is not conditional on such fine points as human rights, clean governance or fiscal restraint. “We welcomed China very much because, for the first time, it gave us a real alternative to a Western-driven agenda, whether it was South Africa or the Western world,” Calle Schlettwein, Namibia’s minister of finance, told me. “The Chinese say, ‘We want you to be masters of your own destiny, so tell us what you want.’ ” But they have their conditions, too, he says. “They want de facto total control over everything, so it’s difficult to bring about a situation that is truly beneficial.”

China’s leaders insist that its influence is entirely benign, a global exercise in what they call “win-win cooperation.” And indeed, many of the projects Chinese companies are pursuing — roads and railways, ports and pipelines, mines and telecom networks — might never be built without them. China’s investment in the Husab uranium mine, in which C.G.N. subsidiaries hold a 90 percent stake and the Namibian government owns 10 percent, is doing its part to stave off a recession. “We helped Namibia gain its political liberation,” Xia Lili, a former Chinese diplomat who now works as an executive at a Chinese company in Windhoek, the Namibian capital, says. “Now we’re helping it fight for economic emancipation.”

For some Namibians, however, the flood of Chinese loans and investments doesn’t look so much like freedom as it does a new form of colonialism. The infrastructure is welcome, but as projects made possible by loans — financed by the Chinese — they have saddled the economy with debt and done little to alleviate the nearly 30 percent unemployment rate. Over the last few months, moreover, a series of scandals involving Chinese nationals — including tax evasion, money-laundering and poaching endangered wildlife — has soured locals on a foreign presence that can seem largely extractive: pulling uranium, timber, rhino horns and profits out the country without benefiting a population that, because of apartheid’s legacy, ranks among the most unequal economically in the world. In January, a Windhoek newspaper captured the rising sentiment with an illustration on its front page of a golden dragon devouring the Namibian flag. The headline: “Feeding Namibia to the Chinese.”