Traffic on Los Angeles County’s Interstate 10–one of the most congested thoroughfares in the U.S.–is creeping along at the glacial pace of 15 miles an hour (50 miles an hour slower than the posted speed limit) even though it is long past the morning rush. I maneuver my rental car past the 405 interchange, take the La Cienega Boulevard exit, and finally arrive at my destination, the Mercedes-Benz Driving Academy, a gleaming, 4,000-square-foot facility near Beverly Hills. I’m greeted by Carolyn Duchene, a longtime Mercedes-Benz executive who oversees one of the luxury-auto maker’s newest projects: a private driving school that aims to impart behind-the-wheel tips–and promote the luxury brand’s relevance–to teens. “Sorry I’m a little late,” I say, still breathless from the commute. Duchene isn’t fazed: “It’s L.A.,” she says matter-of-factly.

With more than 6.1 million registered automobiles and a population of about 10 million, the L.A. metropolitan region has more cars per capita than any other urban area in the world. This city–from the 405 to the 110 to the 10–was built for driving, of course. Angelenos clock a combined 300 million miles every day (each of them spends an estimated 90 hours a year just sitting in traffic jams, which is more time than they devote to procreating or brushing their teeth). But despite its population’s longtime love affair with cars–Angelenos pretty much invented the drive-up, drive-through, and drive-in–L.A. is on the frontlines of a surprising tectonic shift that’s taking place all across the U.S.: People, particularly young adults, aren’t driving as much as they used to. Today only 77% of Americans ages 20 to 24 have a driver’s license, down from about 90% in the early 1980s. For the first time since the advent of the automobile, the collective number of miles traveled by car is in decline–since peaking in 2004, it has dropped about 9% (see chart below).

What’s (ahem) driving the trend? The rise of a new kind of city living–and working–is a big factor. Young professionals, including those with families, are increasingly opting for urban life. And cities, even Los Angeles, are responding with new or improved public-transportation systems, bike-sharing programs, and more pedestrian-friendly thoroughfares. Companies, in turn, are moving back to cities or opening satellite offices downtown to be close to the talent. Exhibit A: San Francisco, which has supplanted Silicon Valley as the HQ city of choice for companies such as Salesforce.com and Square and Twitter.

CIT.06.30.14 american driverSource: Michael Sivak, University of Michigan

Silicon Valley, meanwhile, is doing its own part to doom driving. The proliferation of mobile-app-based rides like Uber, Lyft, and Sidecar all but eliminates the need for car ownership, especially among technology-savvy twentysomethings. One tech stalwart is even working to eradicate the steering wheel–literally. Google’s driverless car, once the stuff of science-fiction flicks, is fast becoming a reality. (Its latest prototype, a buglike pod sans steering wheel, won rave reviews from a skeptical auto press.)

While autonomous vehicles won’t erase the need for cars, they could certainly put a dent in demand and further our emotional detachment from automobiles, utilizing algorithms, not drivers, to shuttle multiple passengers to their destinations. An additional byproduct: Google and its proponents claim that unmanned cars will cut down on accidents and inefficient driving and even reduce the space that offices need to allocate to parking (the cars could just move themselves around). Instead of fighting traffic, erstwhile drivers could be working on their laptops, reading, even doing sit-ups in the back of a souped-up mobile gym. “We think the self-driving car is going to work and be far safer than human drivers,” says Silicon Valley venture capitalist Marc Andreessen, who has a pretty good track record for predicting the future. “In 10 years it will be quite common, and one day we’ll think it was lunacy we ever let a human behind the wheel.”

This collision of technology, lifestyle changes, and attitudes–research suggests that young people today are more ambivalent about auto brands than previous car-craving generations were–represents a major shift in the way Americans think about driving. The romantic ideal of the open road and cross-country drives has given way to crippling, stress-inducing traffic, high rates of road fatalities, and safety issues, including General Motors’ recent recall of 14 million vehicles in the U.S. After taking a major hit in the last recession, U.S. car sales have steadily grown for the past few years. But the number of automobiles sold in the U.S. last year, 15.6 million, is still significantly lower than the 16.7 million sold in 2003. What’s more, analysts expect the recent growth to start slowing over the next five to 10 years as aging baby boomers exit the market and millennials–many of whom would rather own the latest smartphone than a new car–enter it. In short, many Americans still love–and need–their cars, but the golden age of driving may be in the rearview mirror.

CIT.06.30.14.mapROAD MAP: Automakers are planting their flag in Silicon Valley. Their mission? To tap local talent, increase their relevance with a new, tech-centric generation, and find new revenue streams in an industry whose growth may start tapering in the coming years. Click map to enlarge.

Carmakers get it. “The car is no longer the gateway purchase to adulthood,” says Sheryl Connelly, Ford’s global trends and “futuring” expert. Yes, Ford has a futurist on staff. It also has a research center in Silicon Valley. In fact, virtually every major carmaker–from Volkswagen to Toyota to GM–has set up shop in America’s cradle of innovation. (See map). From tinkering with self-driving cars to investing in their own ride-sharing services to opening high-end driving schools for teens, they’re aggressively looking for new ways to propagate their relevance and ensure that the incoming generation of consumers will still want to buy their cars–even if it is just to rent them to others via mobile-connected sharing services.

A few hours before my crawl down the freeway to the Mercedes-Benz Driving Academy, I walk from my beachside hotel room to Santa Monica City Hall. There I meet Francie Stefan, the city’s strategic and transportation planning manager. Both in her current role and as a former planner with the city of West Hollywood, Stefan has devoted much of her career to championing public transport. Today she shows me the budding fruits of her labor. We step into a white Toyota Prius (it’s a city-owned car; Stefan bikes to work), and as we drive out of the parking lot, she points excitedly at a line of five cyclists waiting to cross the nearby intersection of Main Street and Pico Boulevard. “That never used to happen before–this is the new Santa Monica,” she says.

In addition to bike lanes throughout the city’s main roads, the “new” Santa Monica is overhauling its bus system and widening sidewalks. More significantly, a light-rail line, scheduled to open by early 2016, will connect downtown Los Angeles and the coastal city of Santa Monica for the first time. The so-called Subway to the Sea will allow Angelenos to make the normally hellish trek in about 45 minutes–yes, even during rush hour. “We’re realistic,” says Stefan as she shows me the soon-to-be-operational Colorado Avenue light-rail station, where men in hardhats are still laying down track. “We’re trying to shepherd transition in a reasonable way.”

CIt.06.30.14.-buyersSource: LMC Automotive

Santa Monica says it has already seen a 67% increase in walking and biking across the city. Of course, not everyone is a fan of the changes; some residents and businesses have fought to open more auto lanes rather than invest in alternative transportation or bigger sidewalks. But ultimately, over the past few years both the money and votes have come out in favor of making the city more walkable. The same trend is taking place across the larger L.A. region, where the percentage of people who walked, biked, or took public transportation to work instead of driving has doubled, to 22%, since 2001, according to a survey conducted by the California Department of Transportation. Driving, meanwhile, has fallen 12%. “There is a very strong movement toward living, working, socializing, and entertaining closer to home,” says Rick Caruso, a California real estate developer. “If you don’t have to get into a car, it’s golden.” (The real estate tycoon, who owns the Grove entertainment and retail complex in central L.A., says 30% of traffic to the popular shopping destination is by foot.)

L.A. County is not an outlier. Rather, it’s indicative of similar transformations taking place across metropolitan areas, from Portland, Ore., to Washington, D.C. In Florida a privately owned passenger rail system will soon open an express, intercity train route that will shuttle people between Miami and Orlando in less than three hours. In Las Vegas, Zappos CEO Tony Hsieh is pouring hundreds of millions of dollars into Project 100, a service that lets residents borrow bikes or shared cars for a monthly fee. (For more, see our Q&A.) And in Minnesota a light-rail line connecting the downtowns of St. Paul and Minneapolis will begin service later this summer. In the future “people will often choose a place to live before they choose a job,” predicts Minneapolis mayor Betsy Hodges. “And one of the things they’re looking for in the places they want to live is the ability to get around without a car.” Just look at New York City, where more than half of households are carless.

Cities have another incentive to offer more public transportation options and become friendlier places for walking. In her book The End of the Suburbs, Fortune assistant managing editor Leigh Gallagher pulls together a growing body of research that shows commuting by car isn’t just bad for the environment; it’s also bad for our health. People who live in urban areas tend to weigh less than their suburban counterparts. A study on happiness by Princeton University psychologist Daniel Kahneman and economist Alan Krueger found that commuting was consistently rated the worst part of people’s day (sex was the best). Another study, in Switzerland, found that people with long commutes report a lower sense of overall well-being.

CIT.06.30.14.where-the-carsSource: Michael Sivak, University of Michigan

Technology companies are swarming in to meet the increasing demand for nontraditional modes of transportation. Despite legal complications and complaints from taxi and limousine commissions, Uber and a growing list of ride-sharing services are exploding in cities across the globe. They’re also commanding big funding rounds and valuations–Uber recently completed a round of funding that values the company at a whopping $18.2 billion–more than Hertz’s market capitalization. Ride sharing is already starting to take a bite out of the auto industry: Research indicates that 32 new-vehicle sales are lost for every car added to a ride-sharing fleet. The source of this startling statistic? AlixPartners, the restructuring firm that helped guide GM out of bankruptcy. “Car ownership isn’t going to go away,” says Balaji Prabhakar, co-founder and chief scientist of Urban Engines, a Silicon Valley-based startup that uses data analytics to help cities ease congestion. “But it is not unlikely that it goes down.”

It’s bike-to-work day at Google, but the parking lots around the company’s headquarters are still packed. Over the years the tech giant has invested in several car-free alternatives for its more than 50,000 employees, including colorful bikes, Segways, and scooters for everyone to share. It also operates a massive (and controversial) private bus system that lets Googlers shuttle between San Francisco and the company’s sprawling offices in Mountain View, Calif. One of the company’s latest experiments is a pilot program with GM that gives employees access to 50 all-electric Chevrolet Spark EVs. The brightly colored cars are parked in rows, plugged into outdoor electrical outlets. Employees share the vehicles, utilizing a mobile app that matches drivers and cars on morning and evening commutes. “It’s good for the environment and good for my pocket,” says Sohail Razzaq, a 27-year-old business-operations associate at Google who uses the company’s new internal ride-sharing service to get to and from work and home.

If it takes off, the pilot has some obvious potential advantages for Google. (Despite its suburban location, traffic around the company’s headquarters during rush hour is at a complete standstill, and its parking lots are overloaded.) But it has even bigger implications for GM. “Our historic model has been ‘Design, build, and sell vehicles,’ ” says Peter Kosak, executive director of GM’s urban-mobility division. “Fleet maintenance, data and analytics, and ride sharing–these are not things that we’ve historically done.”


Interactive by Analee Kasudia

Automakers are smartening up to the fact that they can’t stop Uber or urbanization or any other trend from taking place. That’s why so many of them have flocked to Silicon Valley–the new hub of automotive innovation. After all, this is where Tesla Motors, the only successful new American carmaker in decades, is based. It’s also home to some of the most cutting-edge research on autonomous cars (again, courtesy of Google), connected vehicles, and, of course, a plethora of ride-sharing and alternative-transportation startups. And while carmakers have traditionally run relatively closed-off operations in Detroit and other automotive hubs around the world, they’re now realizing they need to open up and work with–not against–Silicon Valley. “In all my career I have never seen a more disruptive time in transportation,” says GM’s Kosak.

In an effort to jump into the ride-sharing business, a few years ago GM partnered with San Francisco-based RelayRides. The deal aimed at enabling millions of car renters to unlock GM cars with their mobile phones. But the results were mixed, and in late 2013 the companies announced they were discontinuing the partnership. The failure hasn’t caused GM to give up. In fact, Kosak says, partnerships are more important than ever. To that end, both GM and Toyota recently announced that they would give discounts on new-car purchases to Uber drivers. Other carmakers are linking up with app developers to get all sorts of connected services–from social media to navigation to streaming music–into their cars or tapping the brains of nearby universities and research institutes to dabble in self-driving vehicles. Volkswagen, whose R&D shop is in nearby Belmont, is working on incorporating more advanced speech-recognition and autonomous driving functions across its car models.

Mercedes-Benz, a division of German conglomerate Daimler, has long had a small presence in Silicon Valley, but it has scaled up to 150 employees, mostly engineers, in recent years. “People are changing the way they purchase their vehicles and the way they get from point A to point B,” says Rasheq Zarif, senior manager of Mercedes-Benz’s business innovation group. “We’re moving beyond vehicle manufacturing.”

CIT.06.30.14.change-in-habitsSource: U.S. Department of Transportation

To that end, the luxury-car maker recently launched a service called Boost by Benz, which shuttles kids to soccer games and piano lessons in a candy-colored Mercedes-Benz van, complete with concierge service (as if getting picked up by your mom or dad weren’t embarrassing enough). It has also invested in its own car-sharing service, car2go, and, of course, opened up its posh L.A.-based driving school. It’s still early days for the Mercedes- Benz Driving Academy, but four additional locations are already up and running abroad, and Duchene, head of the L.A. school, says the company is evaluating other locations in the U.S. “It’s about how to extend our brand beyond our normal business,” she says.

But even if some of these efforts prove to be successful, they represent a potentially game-changing shift for car manufacturers. In an era in which consumers have become accustomed to regular, over-the-air updates and upgrades of their consumer electronics products, they’ll expect the same kind of service from their cars. Automakers need to find alternative revenue sources in urban regions of the world, where a combination of smarter cities friendlier to public transportation, and young people more prone to sharing than purchasing vehicles, will mean fewer car sales. And car companies need to find a way to rekindle young America’s passion for vehicles, a fervor that wasn’t lost so much as replaced by a different kind of shiny new toy. “It’s wild to me how phones have seemingly destroyed all the sex appeal of cars for young people,” says Jason Duckworth, president of Arcadia Land Co., a developer of walkable neighborhoods outside Philadelphia. “To them, cars are just another way to get around and no longer loaded with the symbolism they once had.”

Back in L.A. County, I exit the Mercedes-Benz school–alas, no classes were in session during my tour–and brace myself for the haul down the 405 toward the airport. The irony that so much of this story was reported by car is not lost on me. Then again, I’m not of the driving-averse millennial generation. For me, the car is a primary and necessary mode of transportation–and sometimes even an enjoyable one. But after battling L.A. traffic all morning, I gladly return my rental car and hop into a shuttle to the airport. I sit back, breathe a sigh of relief, and pull out my smartphone.

This story is from the June 30, 2014 issue of Fortune.