In the fall of 2009, Jim Chanos began to ask questions about the Chinese economy. What sparked his curiosity was the realization that commodity producers had been largely unaffected by the financial crisis; indeed, they had recorded big profits even as other sectors found themselves reeling in the aftermath of the crisis.

When he looked into why, he discovered that the critical factor was China’s voracious appetite for commodities: The Chinese, who had largely sidestepped the financial crisis themselves, were buying 40 percent of all copper exports; 50 percent of the available iron ore; and eye-popping quantities of just about everything else. That insight soon led Chanos to make an audacious call: China was in the midst of an unsustainable credit bubble.

Perhaps you remember Jim Chanos. The founder of Kynikos Associates, a $3 billion hedge fund that specializes in short-selling, Chanos was the first person to figure out, some 15 years ago, that Enron was a house of cards.

He shorted Enron stock — meaning that he would profit if the stock fell, rather than rose — and shared his suspicions with others, including my friend Bethany McLean, who wrote a story for Fortune that marked the beginning of the end for Enron. That call not only made Chanos a small fortune; it also made him famous.

Chanos and his crew at Kynikos don’t make big “macro” bets on economies; their style is more “micro”: looking at the fundamentals of individual companies or sectors. And so it was with China. “I’ll never forget the day in 2009 when my real estate guy was giving me a presentation and he said that China had 5.6 billion square meters of real estate under development, half residential and half commercial,” Chanos told me the other day.

“I said, ‘You must mean 5.6 billion square feet.’ ”

The man replied that he hadn’t misspoken; it really was 5.6 billion square meters, which amounted to over 60 billion square feet.

For Chanos, that is when the light bulb went on. The fast-growing Chinese economy was being sustained not just by its export prowess, but by a property bubble propelled by mountains of debt, and encouraged by the government as part of an infrastructure spending strategy designed to keep the economy humming. (According to the McKinsey Global Institute, China’s debt load today is an unfathomable $28 trillion.)

Chanos soon went public with his thesis, giving interviews to CNBC andCharlie Rose, and making a speech at Oxford University. He told Rose that property speculation in China was rampant, and that because so much of the economy depended on construction — in most cases building properties that had no chance of generating enough income to pay down the debt — China was on “the treadmill to hell.”

He also pointed out that much of the construction was for high-end condos that cost over $100,000, yet the average Chinese household made less than $10,000 a year.

Can you guess how the financial establishment, convinced that the Chinese juggernaut was unstoppable, reacted to Chanos’s contrarian thesis? It scoffed.

“I find it interesting that people who couldn’t spell China 10 years ago are now experts on China,” the well-known investor Jim Rogers told The New York Times. He added, “China is not in a bubble.”

The conventional view was that the Chinese economy would continue to grow at a rapid pace, and that Chinese officials, unencumbered by the messiness of democracy, could make quick adjustments if the economy started to slip.

Chanos was undeterred. “It reminded me of 1989, when everybody said that we should emulate the Japanese model,” he told me. “They used to say, ‘They can get stuff done and we can’t’ ” — just as the supposed experts were now saying about China.

As it turns out, China’s economy began to slow right around the time Chanos first made his call. No matter: Most China experts remained bullish. Chanos, meanwhile, was shorting the stocks of a number of companies that depended on the Chinese market. And he was regularly sending out emails when he came upon articles that seemed to confirm his thesis: stories about newly constructed ghost cities and troubled banks and debt-laden state-owned enterprises.

These days, with the markets in free-fall, it certainly looks like Chanos has been vindicated. China’s not the only reason the stock market has been so volatile, but it’s the most important one. China’s economy is faltering, its stock market is collapsing, and the ham-handed efforts by government officials to prop up both have mainly had the effect of disabusing anyone who still thinks the government can revive the economy with the snap of its fingers. This loss of confidence in China and its leaders has spooked stock markets around the world.