Across this populous African nation, low-cost Chinese goods are everywhere, evidence of Beijing’s growing dominance in global trade. The trade flow has helped keep life affordable for millions of Nigerian families, at a time when the country is struggling with economic stagnation and plunging prices, as well as the deadly costs of the Boko Haram insurgency.

But shoddy or counterfeit products are a national problem in Nigeria, Africa’s largest economy, where impoverished consumers have few alternatives. Some shoddy goods are benign, like the Chinese-made shirts, trousers and dresses with uneven stitching and stray threads that fill street markets. But electrical wiring, outlets and power strips from China, ubiquitous in new homes and offices, are connected to dozens of fires a year in Lagos alone.

The relationship between China and Nigeria is a complex web of dependency, one replicated in dozens of developing countries around the world, like Chile, Ethiopia and Indonesia. Such ties are integral to China’s global ambitions. President Xi Jinping of China, who was in Africa this week emphasizing economic diplomacy, just committed $60 billion in development assistance to the Continent.

But such efforts also pose new and unpredictable challenges for Beijing. China has lent heavily to commodity-exporting countries, which are now struggling with low commodity prices. At the same time, China’s highly competitive manufacturing sector has devastated many smaller-scale rivals across Africa, Asia and Latin America. Mr. Xi’s pledge in Africa, in part, seemed aimed at quelling criticism over what some see as a lopsided relationship that largely benefits China.

To support its swelling trade in Nigeria, China is funneling billions of dollars to build roads, rail lines, airport terminals, power plants and other desperately needed infrastructure. China is the top lender to Nigeria, where political instability and violence have made Western interests skittish.