As the yuan tumbled during the past few weeks, Chinese consumers have been scrambling to change the currency for U.S. dollars, causing cash shortages at some mainland banks.

At major lender Industrial & Commercial Bank of China Ltd., one banker said the number of people wanting to change yuan for dollars has increased significantly during the past three weeks—a period during which the Chinese currency has declined about 2%.

During...