Sidney Rittenberg, an American soldier-linguist who stayed in China for 35 years after World War II as an adviser and political prisoner of the Communist Revolution, and later made millions as a counselor of Western capitalists exploiting booming Chinese markets, died on Saturday in Scottsdale, Ariz. He was 98.

The family confirmed the death in a statement.

In a saga of Kafkaesque twists, Mr. Rittenberg was a dedicated aide to Chairman Mao Zedong and Premier Zhou Enlai as a party propagandist known across China by his Mandarin name, Li Dunbai — the mysterious foreigner in Mao’s government. But he ran afoul of Mao’s suspicions, offended Mao’s wife and spent 16 years in prison, falsely accused of espionage and counterrevolutionary plotting.

In the United States after his release, he used his extensive knowledge and contacts in China to build his own capitalist empire, advising corporate leaders, including Bill Gates of Microsoft and the computer magnate Michael S. Dell, on how to cash in on China’s vast growing economy. Still welcome in China, he took entrepreneurs on guided tours, introducing them to the country’s movers and shakers.

“His compelling tale can perhaps best be understood as a story, writ small, of modern-day China itself,” the author Gary Rivlin wrote in The New York Times in 2004. “His metamorphosis from isolated expatriate to high-priced global go-between mirrors the country’s own shift — from a closed-door Communist state to a freewheeling moneymaking society, with a new class of entrepreneurs who dream the same dreams that dance in the heads of people in places like Silicon Valley.”