DETROIT—The auto industry’s recent fat profits from rising demand for new cars in North America is about to confront the law of supply and demand: A string of new factories in the region will start cranking out a million or more cars over the next several years.

A large increase in production capacity poses a serious risk for auto makers. They reap strong profits if their factories are running near 100% of capacity, but their losses…