Mr. Brin's presentation in Rancho Palos Verdes, Calif. — including a video of a compact two-seater autonomously doing laps around a parking lot — jolted Mr. Kalanick, according to two people who spoke with him. Google, the search giant — long considered an Uber ally — seemed to be turning on him. And even as Uber was a growing force to be reckoned with, it was lacking in self-driving car technology, an important field of study that might affect the future of transportation.

So Mr. Kalanick spent much of 2015 raiding Google's engineering corps. To learn about the technology, he struck up a friendship with Anthony Levandowski, a top autonomous vehicle engineer at "G-co," Mr. Kalanick's pet name for Google.

The two men often spoke for hours about the future of driving, meeting at the Ferry Building in San Francisco and walking five miles to the Golden Gate Bridge, according to two people familiar with the executives, who asked for anonymity because they were not authorized to speak publicly.

Tony Avelar | AP

Uber CEO Travis Kalanick, left, and Anthony Levandowski, co-founder of Otto, pose for a photo in the lobby of Uber headquarters, Thursday, Aug. 18, 2016, in San Francisco.

The friendship developed into a partnership. Mr. Levandowski left Google last year to form Otto, a self-driving trucking start-up. Uber acquired it months later for nearly $700 million. Mr. Kalanick subsequently appointed Mr. Levandowski to run Uber's autonomous vehicle research.

That relationship has since set off a legal morass, with Google's self-driving vehicle business — now called Waymo — accusing Mr. Levandowski of creating Otto as a front to steal trade secrets from Google, then using the findings with Uber's driverless cars. On Monday, a federal judge in San Francisco barred Mr. Levandowski from working on a crucial component of Uber's self-driving car technology for the duration of the case.

The implications are set to reverberate far beyond the courtroom. Any setback for Uber will shake up the driverless car industry, which is locked in a bitter race to introduce and commercialize autonomous cars. Silicon Valley tech titans and Detroit automakers are making huge investments — bets that autonomous vehicle technology will usher in a new age of how people get around. For some companies, especially traditional carmakers, their very survival is at stake.

While Google has been developing autonomous vehicle technology for more than a decade, others have raced to catch up. General Motors, Ford, Apple, Tesla, Volkswagen, BMW and Mercedes-Benz are among those that have jumped in. All are competing — and sometimes cooperating — for a slice of a new market expected to top $77 billion over the next two decades, according to a study from Boston Consulting Group.

Uber has been ahead of many others in publicly testing autonomous vehicles. Last year, the company began a pilot program of autonomous cars in Pittsburgh; it has also done testing in San Francisco and Tempe, Ariz.

That aggressiveness has spurred an intense rivalry with Waymo. Waymo's legal pursuit of Uber and Mr. Levandowski is out of corporate character; Google has tended to refrain from suing former employees who move to competitors. Many at Google and Waymo are incensed at Mr. Levandowski and how he may have betrayed them for a rich payday, according to current and former employees.

That has pushed Waymo to strike back. Beyond suing Uber, Waymo said on Sunday it had teamed up with Lyft, a ride-hailing rival, on driverless car initiatives.

"This is a race where every single minute seems to count," said Carl W. Tobias, a professor at the University of Richmond School of Law, who has followed the Waymo-Uber case.

Uber and Waymo declined to comment for this article.

Uber and Google once considered each other allies. Google's venture capital arm, now known as GV, spotted Uber's potential early and invested more than $200 million in the fledgling ride-hailing network in 2013.

David Drummond, then Google's chief legal counsel and an early Uber enthusiast, took a seat on Uber's board. At one point, Google promoted Uber as a transportation option in the Google Maps app, and Uber drivers relied on Google Maps.

But the relationship crumbled as the two companies' paths converged. Google began testing its own car-pooling service inside Waze, a mapping app it owns. Uber eventually moved away from relying solely on Google Maps.

At the same time, Uber ramped up its own driverless car efforts. In 2015, Uber opened the Advanced Technologies Center in Pittsburgh, home to its self-driving work. It hired Brian McClendon, Google's head of maps, and brought on staff members from Carnegie Mellon University.

Around then, the friendship between Mr. Levandowski and Mr. Kalanick deepened, according to people close to both men. After "jam sessions" between the two — essentially brainstorming meetings where they would walk and talk over the future of driving — Mr. Kalanick's pedometer would clock in with thousands of steps.

Ramin Rahimian | The New York Times

Anthony Levandowski, left, and Lior Ron, the co-founders of Otto, a 90-person start-up focused on developing self-driving truck technology, at the Otto offices in San Francisco, May 16, 2016. Uber has announced it has acquired Otto, a move that is the most recent indication of the company's ambitions for autonomous vehicles that can provide services to both consumers and businesses.

Both men had little love for Google. Mr. Levandowski had grown impatient with the pace at Google's self-driving car unit, which was suffering from infighting and had been slow to move forward with some of its plans, according to two people familiar with Mr. Levandowski.

Mr. Kalanick, meanwhile, had realized the growing threat from Google. Uber's reliance on Google Maps was making him nervous, especially after Google started "rate-limiting" Uber's use of the service, asking Uber to pay for access over time.

Mr. Kalanick also had a personal ax to grind with Mr. Brin. The night before the 2014 tech conference, Mr. Kalanick received a call from Mr. Drummond, who said Mr. Brin may raise the possibility of Google's dabbling in the ride-hailing market onstage the next day — a way to monetize autonomous vehicles — according to three people familiar with the conversation. Google stopped short of saying it planned to introduce such a service, , but Mr. Brin showed Google's self-driving car.

Mr. Kalanick was shocked at what he saw as a potential strike against Uber, according to people with knowledge of the event. He and Mr. Brin were supposed to clear the air at a private dinner that evening, but they spoke only briefly. After Mr. Brin's presentation, Mr. Kalanick later called Mr. Drummond to vent for what he considered an unexpected ambush from a friend and partner.

In February of this year, Waymo sued Uber. Uber had crossed the line, Waymo said in legal documents, with Mr. Levandowski's start-up created as a way for Uber to steal trade secrets and copy its designs for lidar — short for light detection and ranging, a crucial hardware component in an autonomous vehicle.

Before Mr. Levandowski left Google, Waymo claimed, he and other Google staff members who would become Otto employees took thousands of files of research, as well as valuable supplier lists, manufacturing details and other technical information. Mr. Levandowski then tried to cover his tracks, according to the complaint, wiping his laptop's hard drive of its data.

The behavior could be traced to December 2015, Waymo said. At the time, Mr. Levandowski searched Google's network for login details for a document repository for the autonomous vehicle program, whose code name was "Chauffeur." He then installed software that let him download 9.7 gigabytes of data on Google's driverless car program. A few days later, Mr. Levandowski put a memory card into his laptop for eight hours, according to Waymo.

Waymo discovered the deception inadvertently when it was copied on an email from a supplier, with drawings of Uber's design for its lidar. The designs bore a "striking resemblance" to Waymo's designs, the company said.

"Otto and Uber have taken Waymo's intellectual property so that they could avoid incurring the risk, time and expense of independently developing their own technology," Waymo said in its lawsuit.

Uber has denied it used stolen trade secrets, though its defense largely avoided the question of whether Mr. Levandowski pilfered files. Mr. Levandowski, who is not on trial, has chosen to invoke his Fifth Amendment right against self-incrimination. He has stepped down from leading Uber's Advanced Technologies Group, but remains in charge of testing self-driving vehicles.

On Monday, the federal judge in the case said Waymo had shown "compelling evidence" that Mr. Levandowski "downloaded over 14,000 confidential files before leaving the company." He ordered Uber to return any files to Waymo. The judge had separately referred the case to the United States attorney's office, raising the possibility of criminal charges for those involved.

The case is headed to trial this year, but Mr. Levandowski is planning a break from the legal action. He and Eric Meyhofer, another Uber self-driving car executive, are discussing a trip to Indiana, according to two people familiar with the plans. There they intend to watch the Indianapolis 500 over Memorial Day weekend.