Photograph by Adam Levy for Fortune Magazine

How 100-year-old BMW is racing toward automated driving, electric cars, and ride sharing. This year BMW turns 100, and it’s still roaring like one of its deep-throated V-8 engines. In 2015 it outsold rivals Mercedes-Benz and Audi for the 11th straight year, keeping its crown as the largest luxury-car maker in the world. The newly launched 7 Series, which has reclining rear seats, has been wowing the auto press. What could go wrong? Well, plenty. If Munich-based BMW wants to stay ahead of the pack, it must figure out how to maneuver through the biggest disruption in transportation since the car displaced the horse-drawn carriage. And that disruption is coming faster than most think. “The next 10 years will bring more change than the last 30,” says Christoph Grote, head of BMW’s advanced technologies group. We’re not talking about more horsepower or improved handling. The very essence of the automobile is up for grabs. BMW’s honchos believe that new modes of transportation are needed to reduce traffic and boost safety while lowering greenhouse gas emissions and air pollution. It’s a major transformation that can be divided into three elements: autonomous driving, electrification, and car sharing. “There is an exciting alternative to the auto industry as we’ve known it over the last 100 years,” says Larry Burns, who once ran R&D for GM gm and now advises Google googl . “A lot of people will no longer be driving themselves in heavy gas-powered vehicles that they own personally, and the industry is going to have to adapt to that.” That means BMW is now competing with some of the tech world’s most powerful names. Google, Apple aapl , Tesla tsla , and others are spending billions to build or plan electric, self-driving cars made of lightweight composites. Tesla has become the leading seller of electric cars in the U.S. Google could have self-driving vehicles on the road within five years, a decade before the major automakers say they can do it. A Chinese startup named Faraday Future, backed by an Internet billionaire, Jia Yueting, announced that it is building a $1 billion electric-car factory in Nevada and unveiled its 200 mph concept car in January. “We’re going back to the future where we have the same kind of auto brand proliferation like we saw at the beginning of the 20th century,” says Tesla’s vice president of business development, Diarmuid O’Connell. To see BMW’s profile on our World’s Most Admired Companies list, click here. BMW’s new competitors have audacious ambitions. Uber, for example, is partnering with robotics experts at Carnegie Mellon and spending heavily to design a self-driving vehicle. The car-hailing service says its core vision is to “end private car ownership.” CEO Travis Kalanick reportedly told Tesla CEO Elon Musk that if Tesla could build 500,000 autonomous cars in 2020, Uber would buy every one of them. Kalanick’s notion: a massive fleet of self-driving Uber vehicles ready to pick you up whenever and wherever you’d like. That’s a bit of hyperbole, perhaps, but there’s plenty to worry traditional automakers, starting with the fact that, increasingly, what differentiates cars is their software. A typical premium model has 100 million lines of code, according to Boston Consulting, which estimates that a vehicle’s electronics as a percentage of its total cost has doubled from 20% in 2004 to 40% last year. Software, obviously, is where Silicon Valley excels. Still, BMW maintains it will lead this revolution. “Electro-mobility and digitalization are the clear drivers of the right strategy for the future,” says BMW CEO Harald Krueger. Adds Ulrich Quay, who runs the company’s venture investing unit: “We will not succeed if we just keep doing business in the same way.” BMW’s new ways start with launching cutting-edge electric and plug-in hybrid cars, including the popular i3 city car and the head-snapping i8 sports car. Its 7 Series can drive itself on the highway. BMW has invested in companies that enable you to rent or share a car, find parking, and get traffic information. This fall BMW joined Audi and Daimler to acquire Nokia’s digital mapping and location services business for roughly $2.8 billion—an essential component of self-driving technology. And BMW has been working on mobility technologies similar to those of its Silicon Valley rivals. Yet being aware of these trends is not the same as capitalizing on them. BMW faces the classic innovator’s dilemma: Successful established companies get pushed aside unless their managers know when to abandon the very products that built their prosperity. Auto manufacturers like BMW have a huge legacy to overcome, including the billions invested in factories that make gasoline-powered vehicles. Add to that unionized workforces, hidebound dealers, and conservative boards of directors. Photograph by Myrzik and Jarisch “It’s going to be the agile that will end up the winner,” says BMW’s Grote. “We are a great company with a lot of engineering talent. We never got stuck on what we have but always have invested in future technology to build something our customers love. And if you do that, you shouldn’t be afraid of the future.” But if self-driving cars become the norm, how will BMW market itself as the ultimate driving machine?

BMW made its reputation by building fast, great-handling cars with high-performance gasoline engines. That formula is speeding toward a brick wall. According to the International Energy Agency, the number of cars and other light-duty vehicles on the road will double to 2 billion by 2050. Most of that growth will occur in the developing world. The air quality and traffic jams in Beijing and Mumbai are already horrendous. Imagine what will happen when you boost the numbers of cars on those roads dramatically. Something has to give. Governments are already putting increasingly strict limits on emissions. In the U.S., automakers’ fleets will have to average 54.5 miles per gallon by 2025. In the EU, regulations will force carmakers to reduce their average CO 2 output per car to about 95 grams per kilometer traveled by 2021, a 27% reduction from today. China is adopting standards based on the EU rules. Perhaps the biggest challenge comes from California. By the 2025 model year, 15.4% of vehicles sold in the Golden State will have to be what regulators define (with some latitude) as having “zero” emissions—electric, hydrogen, or a plug-in hybrid. The auto research firm Edmunds estimates that in California alone companies would have to sell 270,000 such vehicles annually, up from a few thousand today, to meet the standards. Nine other states, including New York, New Jersey, and Connecticut, have said they will follow California’s lead. It’s hard to see how tinkering with powertrains will get carmakers where they need to be on emissions. That’s why BMW is pursuing a two-prong strategy: plug-in hybrids and hydrogen cars. Already it offers five plug-in hybrids: the 330e and 740e xDrive, the X5 xDrive 40e SUV, the i8, and the i3. In 2015, U.S. sales of the i3 jumped 81% from the previous year even as gas prices fell. BMW insists it can create the same driving experience with a hybrid as it can with its powerful gasoline engines. After driving the i8 on the streets of Austin, I concluded BMW might have a point. With its gull-wing doors, this $140,700 two-seater sports car employs a small, turbocharged three-cylinder engine and two electric motors for a combined 357 horsepower. The i8 hits 60 mph in 4.2 seconds, faster than the company’s high-performance M3. It handles as well as if not better than any BMW I have driven. On top of that, the car emits only 49 grams of CO 2 per kilometer, well within the 2021 European standards. In the next five to 10 years, BMW’s line will probably consist mostly of plug-in hybrids. Keeping a combustion engine onboard avoids the dreaded range anxiety of electric cars but it also adds weight, complexity, and cost compared with a pure electric. BMW makes an all-electric city car—the i3—but believes that drivers don’t want the hassle of having to charge up every 80 miles. (Indeed, an i3 model with a small gas engine that extends the car’s range to 150 miles has handily outsold the purely electric version.) Photograph by Adam Levy for Fortune Magazine One way to eliminate range anxiety is to build a national network of superfast chargers that can refill an electric in 20 minutes—precisely what Tesla is doing. BMW, however, thinks that’s too expensive. It’s more enthusiastic about hydrogen cars for long-distance travel. A hydrogen car is very similar to an electric but instead of being powered by a battery, it uses a hydrogen fuel cell to run the car’s electric motors. Just fill up with hydrogen and you can drive 300 miles or so. BMW, in collaboration with Toyota, has a hydrogen prototype car about which BMW’s Grote says, “You’d be surprised how convincing it is.” As with electrics, hydrogen cars don’t yet have the fueling infrastructure—a huge shortcoming. Germany is already building such a network, and the state of California has earmarked $200 million to support anyone who wants to build hydrogen stations, but so far the U.S. has only a handful of them. It’s also not clear whether using natural gas—the most common process to make hydrogen—significantly reduces carbon emissions. Hydrogen’s shortcomings have led Tesla’s Musk to refer to the technology as “hydrogen fool.” Another argument against hydrogen is that batteries are getting cheaper and better. GM recently announced it will start selling the Chevrolet Bolt this year, an all-electric that gets 200 miles per charge and sells for $30,000 after federal subsidies. In 2017, Tesla plans to have an all-electric, the Model 3, for $27,500 (after subsidies), with a range of at least 200 miles. Hybrid, electric, and hydrogen cars are more expensive to buy than conventional cars, but the lifetime ownership costs can be cheaper. That’s because electricity costs less than gasoline (hydrogen has similar potential) and the mechanicals and maintenance are simpler (no transmission, complex gas engine, or cooling system). That said, sales of plug-ins, such as the Nissan Leaf and Chevy Volt, have suffered from today’s low gas prices.

Another big philosophical gap between Silicon Valley and BMW is the timetable for self-driving cars. Tesla and Google see no reason they won’t be in use by 2020. The benefits are obvious: reducing global traffic deaths (now 1.2 million each year) and congestion. If you had self-driving cars whirring along the interstates at high speeds, each five feet apart, a four-lane road could handle the same volume as a 32-lane highway. Self-driving vehicles could provide transport for the elderly, the disabled, and the young. You could enjoy a few (or more) glasses of wine at your favorite restaurant and be safely chauffeured home. Musk, speaking last summer at a conference, argued, “We may outlaw driving cars because it’s too dangerous. You can’t have a person driving a two-ton death machine.” Along with most other major carmakers, BMW has gotten on the self-driving bandwagon. It has a 5 Series prototype that can drive itself. Toyota, Nissan, and Daimler have all announced big investments or self-driving concept cars. But most major automakers believe completely autonomous cars won’t be common until 2030 or 2035. First, the technology is expensive (though costs are sure to drop when produced at scale). That’s why the first place we’re likely to see self-driving vehicles is in shared fleets like those Uber is envisioning. A car driven 70,000 miles a year offers a better return on expensive laser and sensor systems than one that’s privately owned. Another worry is that the technology isn’t ready. Can the car react properly if something unexpected suddenly appears in the road? Do you program it to hit a kid who runs in front of your car or direct it into a tree where you end up the casualty? “The human brain is an amazing device,” says Tesla’s O’Connell. “But if we have a learning software out there where every mile a car drives it learns something new, the software becomes safer and more useful.” To understand why Silicon Valley is more optimistic about autonomous vehicles, take a drive with me on Highway 101 in Palo Alto in a Tesla S sedan equipped with its new Auto Pilot software. The owner of the car, Stefan Heck, is a Stanford professor and founder of Nauto, a startup that’s designing a system to retrofit and network today’s cars to make driving safer and more efficient. We are traveling about 75 mph, and I don’t have my hands on the steering wheel. I’m feeling very nervous, and I’m thinking Heck should look a lot more worried than he does. Still, I decide to try the automated lane-change function: I flick the directional signal to the left; the car accelerates until it finds an opening and then darts into the left lane, with my hands still off the wheel. Illustration by The Heads of State As we continue down the 101, I ask Heck why the directional signal keeps blinking after we change lanes. “Good point,” he replies. He touches an icon on the dashboard screen and says, “Make the directional signal automatically turn off after changing lanes.” This bug alert is sent to Tesla’s engineers in Fremont, Calif., who presumably will work on a fix. The point is that Tesla is willing to take risks with self-driving technology and fix problems on the fly. BMW knows how to make a car drive itself. But it’s more cautious—it wants its R&D crew, not its customers, to do the testing. This might be prudent, but it puts the company at a disadvantage. Silicon Valley is very good at quick iterations: Launch, get user feedback, fix, then relaunch. This approach helps explain why the Googles and Teslas of the world believe they can begin selling truly autonomous vehicles a decade ahead of the major automakers.

