Twenty miles east of Reno, Nev., where packs of wild mustangs roam free through the parched landscape, Tesla Gigafactory 1 sprawls near Interstate 80. It is a destination for engineers from all over the world, to which any Reno hotel clerk can give you precise, can’t-miss-it directions. The Gigafactory, whose construction began in June 2014, is not only outrageously large but also on its way to becoming the biggest manufacturing plant on earth. Now 30 percent complete, its square footage already equals about 35 Costco stores, and a small city of construction workers, machinery and storage containers has sprung up around it. Perhaps the only thing as impressive as its size is its cloak of secrecy, which seems of a piece with Tesla’s increasing tendency toward stealth, opacity and even paranoia. When I visited in September, a guard at the gate gave militaristic instructions on where to go. Turning to my Lyft driver, he said severely: “When you complete the drop-off, you are not to get out of the car. Under any circumstances. Turn around and leave. Immediately.”

To hear its executives tell it, Tesla is misunderstood because it is still perceived as a car manufacturer, when its goals are more complex and far-reaching. But at least some people have bought into these grand ambitions. This summer, Tesla’s stock-market valuation at times rose above those of Ford and General Motors, and its worth exceeded $60 billion. It did not seem to matter to investors that the company had never made an annual profit, had missed its production targets repeatedly and had become enmeshed in controversy over its self-driving “autopilot” technologies, or that Tesla’s chief executive, Elon Musk, had conceded that the value of his company, of which he owns about 22 percent, was “higher than we have the right to deserve.” Tesla was a headlong bet on the future, a huge wager on the idea of a better world. And its secretive Gigafactory was the arsenal for a full-fledged attack on the incumbent powers of the car and fossil-fuel industries. The factory would help validate Musk and his company’s seriousness about leading humanity’s turn to greener technologies, with a vision now encompassing solar roofing tiles and battery packs for home and industry. Most crucial, it involved producing millions of Tesla cars and trucks, all of which would be sleek, electric and self-driving.

If ambitions were all it took, Tesla would be crowned the colossus of the global car industry. But rapidly accelerating new technologies have brought uncertainty as well. Automakers are encountering three destabilizing forces all at once: automation, electrification and sharing. And sizing up which companies will be the winners and losers in their wakes is in no way obvious. In terms of self-driving cars, it seems likely that long-established companies — General Motors and Ford, as well as BMW and Audi — will benefit from their substantial reserves of cash and deep manufacturing experience. Because these automakers can invest deeply in research (and spend hundreds of millions of dollars to buy start-ups), they can remain competitive with companies less inherently cautious, like Tesla and Waymo, the spinoff of Google’s self-driving projects.

Tesla’s goal has always been focused on going green, rather than creating the driverless future. (Its mission is emblazoned on its factory walls: “To accelerate the world’s transition to sustainable energy.”) Yet as the automobile industry settles on the consensus that self-driving cars are coming — their promise to improve safety and to help ride-sharing replace car ownership for many Americans propels their inevitability — Tesla finds itself in the midst of a contest to do both. This set of challenges should be enough for any company, especially one led by a chief executive whose time is compromised by other business commitments as a founder of a rocket company (SpaceX), a new tunneling operation (the Boring Company), a company planning a human-computer interface (Neuralink) and a nonprofit focused on the dangers of artificial intelligence (OpenAI). But Tesla has given itself a few others too. One is to essentially reinvent modern manufacturing processes at the Gigafactory. Yet another is to create the first mass-market electric car ever. In the meantime, a company that has never made much profit needs to somehow figure out how to do so — that is, to put itself in the black before financial losses and missed deadlines curdle any hope that Tesla inspires, among customers or stockholders, into skepticism.

Four hundred possible sites all over the western United States were winnowed down to this Nevada location. I hopped into a Chevy Suburban at the Gigafactory with several Tesla employees to take a look around. We drove through an expansive parking lot and up a steep hill so we could overlook the sprawling building and commotion below. The Gigafactory is often described, somewhat reductively, as a plant where Panasonic, a large tenant within the space, manufactures customized lithium-ion batteries that Tesla then installs in its products. Such an enormous plant allows for long production lines and economies of scale, which company engineers believe will help them lower significantly the price of the batteries, and thus the price of electric cars. The logic within Tesla is that only by “scaling up” — making billions of cheaper batteries for millions of cars — can it have an actual impact on our worsening pollution and increasing amounts of carbon dioxide in the atmosphere. The Gigafactory had to be big, Musk noted at its opening in July 2016, “because the world is big.” But the plant’s utility is actually in the sum of countless small improvements. As one Tesla executive involved in its design told me, the goal here was not only to minimize the movement of materials like lithium and cobalt but also to shorten the path of every molecule that moves through the plant. “Because the further a molecule needs to travel,” he said, “the more cost gets added into it. We actually think of it in terms of molecular distance.”

Still, the Gigafactory is considerably more than a battery factory: It’s the physical embodiment of various technological breakthroughs the company — which just manufactured its 250,000th car — is trying to bring to its cars and energy-storage systems. Tesla makes motors here for its new Model 3 car, for instance, which are then trucked to its assembly plant in Fremont, Calif., 240 miles away. When we went inside, after a labyrinthine walk through offices and up and down stairways, we reached a rapidly moving automated factory line, where batteries were being installed into Powerwalls and Powerpacks — the residential and industrial units that store energy collected from solar panels (or any electrical generator). Later in the month, devices like these would make their way to Puerto Rico, where Tesla rebuilt the power infrastructure for a children’s hospital, and southern Australia, where the company is involved in a vast public project to shore up the country’s electrical grid. “We think of this building as a product, because it is a product,” my guide told me as we walked alongside a production line. Every machine had been scrutinized, every inch mapped out, every efficiency contemplated. Tesla had taken the highly unusual step of setting up a separate entity to take full control of the building’s design, engineering and construction, reflecting Tesla’s D.I.Y. ethos to achieve levels of vertical ownership and quality control that its executives believe are unreachable otherwise. The company had even concocted its own Tesla blend of coffee to serve near its cafeterias. “If we cannot get exactly what we want from the world,” one executive told me, “then we have to go do it ourselves.”

Tesla’s grand plans in many respects depend on how much innovation the company can bring to the process of battery making. If the Gigafactory succeeds in reducing costs — one battery-industry analyst, Sam Jaffe, the director at Cairn Energy Research Advisors, told me he thinks the company should be able to drive down the price of its cells by 30 percent — multiple dividends will accrue to Tesla. Cheaper batteries mean more than cheaper cars. They mean Tesla can put larger battery packs into cars for the same cost, increasing the vehicles’ range, power and appeal compared with the competition. At the same time, they could make its home energy-storage systems more efficient. Tesla could also gain an advantage in the race to produce autonomous vehicles, or A.V.s. The electric vehicles, or E.V.s, that Tesla wants to make autonomous have zero emissions. If self-driving cars go on rotation, say, in Uber and Lyft fleets, they could run 24-7, possibly leading to more cars on the road. “One of the concerns about automation is that it’s going to drastically increase the miles we drive,” Stephen Zoepf, the executive director at the Center for Automotive Research at Stanford, told me. “So if we expect as a society that we’re going to be driving a lot more, we obviously want to mitigate the environmental impact.”

At the Gigafactory, J.B. Straubel, a Tesla founder and the company’s chief technology officer, recounted the plant’s origin story. In 2012, he did a back-of-the-envelope calculation and realized that if Tesla were to sell something on the order of 500,000 cars a year, it would require the world’s entire output of lithium-ion batteries at the time. “We realized, holy crap, this means we need a huge factory,” he said, “because there was no way to do this just by putting in an order with some cell company and have them ship a few more.” His projections were not far off. When we met in September, orders for the Model 3, which began production in midyear and has been billed as the company’s first mass-market car, were around 455,000 through July, suggesting that the demand for E.V.s is far larger than any of the traditional automakers ever imagined. In the future, Straubel told me, Tesla plans to put up many more Gigafactories around the world, “ones that are actually quite a lot bigger than this one” — and it would construct those itself too. “This isn’t just a big building that’s full of equipment,” he added. “There’s this idea here of the machine that builds the machine, and it’s really true. This place is the embodiment of that.”

The impression he wanted me to have, I think, was that Tesla, once it gets this prodigious machine humming, will become robotically unstoppable at cranking out smaller machines, a great big clean-energy perpetual-motion device. At the same time, the company’s executives, from Straubel and Musk on down, were urging potential customers not to view each Tesla product in isolation but as parts of an ecosystem. The Tesla customer could soon use Tesla solar roof tiles during the day to charge up a Tesla Powerwall unit, filled with Gigafactory-made batteries — at night the Powerwall could in turn recharge the Tesla sedan. Perhaps the customer very much liked to drive? In that case, he or she might occasionally stop at one of the hundreds of Tesla “supercharger” stations in cities or along highways. Or maybe the owner didn’t like to drive at all and preferred to be driven automatically. Tesla would soon straddle our peculiar moment, the transitional era where humans begin to take their hands off their machines. “Every car made since October of last year,” Musk promised in early August, “is capable of full autonomy, we believe.”

The day after I toured the Gigafactory, I visited Tesla’s California headquarters in Palo Alto to see Doug Field, a top executive involved with the Model 3. Its price begins at $35,000, which gets you an average range of 220 miles on a full battery charge; a model with a larger battery pack (and a range of 310 miles) begins at $44,000. Even that price is a significant step down for the company, whose other cars’ most basic configurations start at about $70,000. I had driven from Reno to Palo Alto in a rented Tesla Model S valued at about $145,000; it was a four-hour trip, not including a 40-minute stop at a Tesla recharging station in Vacaville, Calif., and with the car’s neck-breaking acceleration it seemed the drive could have taken half that time but for speed limits. As the company’s flagship vehicle, the Model S is outfitted with several large LED screens but still has the feel of a conventional luxury car. The smaller Model 3 is a different machine altogether — spry and strikingly austere. One large touch-screen in the center of the dashboard essentially controls all the car’s driving and interior settings, while also monitoring the battery charge. When I arrived in early September, the first Model 3s had just come off the assembly line, and Field, a rangy engineer who spent a good part of his career at Apple, met me in front of the offices in a metallic blue model. He slid into the passenger side and invited me to take the wheel. “I’ll give you a quick orientation,” he said, “and then we’ll drive off.”

Field quickly showed me the controls. There weren’t many except for a few dials on the steering wheel. The screen to its right served as the car’s dashboard. “This looks forward to an era of autonomy,” Field explained, “but it’s also simpler and easier to manufacture.” That meant cheaper too, which was crucial: Tesla had concluded that every dollar saved on the cost of making the car would mean 100 more families could buy it in a year. As we drove through Palo Alto, the car was nimble and responsive, with the same kind of leaping acceleration that characterizes the Model S. But it took some time to get used to checking the screen to my right for my speed and autopilot settings. Field told me his team had concluded that it would be natural and intuitive for a younger generation. “It’s interesting when you put young people in the car,” he said. “This is the way all kids navigate technology.” It’s also possible that the kids might do more navigating, or giving the car orders, than driving. Franz von Holzhausen, Tesla’s design chief, later told me that in creating the car’s interior, he faced the question of making a car that was affordable and stylish but also relevant for a future era. There was vigorous debate within the company about what to do if the Model 3 became truly autonomous. As time went on, von Holzhausen’s group reasoned, this car would be driven less and would be driving more. Thus the decision to jettison dials and controls made sense, because the need for driver information would be reduced, and the central screen could mark routes and arrival times and double as an entertainment center. Those would be the essential tools. Or, as von Holzhausen put it, “The screen then became the hero of the vehicle.”

All of Tesla’s cars, including the Model 3, come with cameras and sensors; the sensors are small radar and ultrasonic devices situated around the car’s exterior that could enable it, presuming the right software is eventually developed, to become self-driving. Because each Tesla car maintains a cellular connection, over-the-air improvements dispensed by the company are a regular feature — tweaking acceleration or braking capabilities through uploaded instructions, for instance. Sometimes the extent to which the company can improve or alter its cars’ performance, even years after they left the factory, can be startling or unsettling, as was the case when Tesla temporarily extended the battery range for some drivers fleeing Hurricane Irma in Florida this summer. Self-driving, which Field assured me would ultimately come to pass with the right software and which Musk has repeatedly promoted to investors and customers, would allow Teslas to become something much more than they are. In the parlance of the Society of Automotive Engineers, which has quantified the capabilities a car must have to be considered self-driving, the vehicles will have nearly attained Level 5. This level denotes a safe and fully autonomous car that can operate in any place, and any conditions, without a driver.

At the moment, Teslas are at Level 2. Their cameras, sensors and software support a more modest capability known as “enhanced autopilot,” which costs an additional $5,000 in a new Model S or Model 3. In certain road and weather conditions, the cars can regulate speed and braking in traffic, steer automatically, change lanes and parallel park autonomously. By some industry rankings, these features now help make Teslas among the safest cars on the road. But following the deadly crash of a Model S driver who was using autopilot in Florida in May 2016, the company reconfigured what the cars permit. When I tried the automated steering on my Model S during the drive from Reno to Palo Alto, for instance, the car chimed frequently in distress and warned me through a dashboard notice when I took my hands off the wheel for a few seconds. I’d been informed that if this happened three times, the car would slow down, stop and rescind my autopilot privileges altogether. I didn’t push it. Clearly, the car — and Tesla, too — still needed its driver.

Whether the current fleet of Teslas can become A.V.s is not merely a technical question for the company; it may prove crucial as Tesla struggles to become a major automaker. In 2006, when Musk began to articulate his aspirations for Tesla publicly, he posted what he called his “Master Plan” on the company’s blog. He wrote that Tesla would transition from making an expensive electric sports car built in small numbers to making a luxury electric vehicle that expanded its manufacturing competence and market share before ultimately entering the electric mass market. The money from one project would be used to fund each successive project. And the larger idea was not to sell cool cars, or even fast cars, but to hasten the transition of automobiles from gas and diesel to electricity. Steve Jurvetson, an early venture investor in Tesla who now sits on its board, told me that there wasn’t much talk of a self-driving future at the start. “I don’t recall a discussion of autonomous vehicles and driving being part of the original pitch of Tesla,” he said. “It was a big-enough issue to prove that an electric drive train could be a success.” As he and Musk knew, there had not been a start-up American car company that had succeeded in nearly a century.

In the summer of 2016, Musk updated his vision for the company — “Master Plan, Part Deux.” In the decade since Part 1, the acceptance of electric vehicles had grown to the point where some traditional carmakers, in a surprising turn, were beginning to speak of an inevitable transition to an era when all models were battery-powered. Entire countries (like China) and enormous markets (like California) were also considering eventual bans on internal-combustion engines. As E.V. technology seemed ascendant, a variety of factors outside the auto industry were creating real potential for self-driving vehicles: great gains in computer-processing power, cheaper hardware sensors, better mobile connectivity, advances in artificial intelligence and enhanced mapping software. In his updated master plan, Musk stated that every Tesla would now have self-driving capabilities and that the application of “fleet learning” — a variation on machine learning — would help the company someday deliver a car that was 10 times safer in self-driving mode than when controlled by a human.

Musk also explained a new fundamental goal of the company. Tesla, he said, wanted to “enable your car to make money for you when you aren’t using it.” In other words, any new Tesla could in due time be part of a sharing network, able to taxi strangers around while its owner worked, slept or did whatever. Most Americans’ cars stay parked about 95 percent of the time. A Tesla would not. In the same way that Tesla’s electric drive train made the American car more efficient, the Tesla network would make the total utilization of the vehicle more efficient, too.

App-based sharing networks for cars already exist: These companies — Turo and Getaround, for instance — are different from, say, Zipcar, because they depend on peer-to-peer communications to arrange for rentals. In essence, they function like mobile Airbnbs, and in some cases have drawn the ire of users in the wake of driver crashes and insurance issues. A Tesla network would push this concept much further, involving perhaps hundreds of thousands or millions of cars, all of them already connected to the internet. Yet such a business network, one Tesla executive told me, most likely wouldn’t succeed unless Tesla’s cars were fully autonomous. Any concerns about insurance and lending a car to a risky driver would disappear, he argued, if autonomous driving proves to be much safer than manual driving. Just as important, autonomy makes irrelevant the problem of getting the car to where it’s needed next — it can be sent wherever it needs to go via mobile app. What’s crucial here is that the Tesla network, if it becomes functional, can defray the cost of an electric car like the Model 3, which is billed as Tesla’s affordable car but can easily surpass $50,000 with various options. If your car is making money for you when you’re not using it, it effectively becomes a tool that uses the virtues of A.V.s to promote the market adoption of E.V.s.

Over the course of several months, I often asked people at Tesla, as well as those working on autonomous technologies elsewhere, how far away the self-driving future might be. There was no solid consensus beyond somewhere between two and five years. I tended to believe that the timeline might extend much further and would depend on how tightly we regulate such vehicles and how we agree to define autonomy. Does it mean interstate driving on a sunny day? Or driving within a dedicated area on city streets? Is it a Level 5 overnight trip through heavy rain from Boston to Washington? A driverless taxi pickup on a crowded street under partial construction — orange cones, backhoes, chaos — as a nightclub lets out? Part of the debate concerns hardware and whether the collection of sensors that automotive engineers now build into their A.V.s can collect enough data to create a fully autonomous car. These sensors generally include radar, cameras and Lidar, the expensive laser-based technology that Tesla has so far declined to use. Many other A.V. researchers consider it essential. Lidar uses light waves, rather than radio waves, to map and “read” a car’s environs.

Musk has promised that before the end of this year, a Tesla vehicle will drive itself coast to coast completely on autopilot. A number of competitors — especially Waymo and General Motors — seem to be closing in on similarly ambitious goals. But it’s worth noting that no Level 5 car has ever been publicly deployed, and it’s doubtful one even exists; the coast-to-coast trip on autopilot, Musk suggested, wouldn’t yet be an instance where a driver could, say, go to sleep at the wheel. What’s more, no Level 4 car, where the vehicle is self-driving under certain weather and geographical conditions, has been put in regular service, either. In fact, while driver-assistance tools like autopilot can greatly reduce crash rates, no company or researcher has ever demonstrated that a robotic automobile can consistently operate in the everyday world more safely than a car with a human driver.

An executive close to Musk told me that his boss believes that creating a true A.V. is a “solvable” problem, one probably less difficult than others he has encountered in various business endeavors — for instance, creating cheap, reusable rockets for SpaceX, his other major company, or pushing Tesla’s Model S to such unlikely success. This may indeed prove true. But unlike other tech innovations, the development of driverless cars cannot count on something like Moore’s Law, which has projected a doubling of computing power at regular intervals and has allowed Silicon Valley entrepreneurs a clear window into the future. Based on conversations with engineers on the A.V. front lines, the most difficult problem is rigging cars with sensors and software that can take a rich, clear, picture of every element in the surrounding environment — people, bikes, signs, obstacles — and then algorithmically choreograph the future.

This challenge is as arduous for Tesla as it is for engineers everywhere working to solve it. And yet the exigencies of Tesla’s business model add an additional layer of complexity. To reach its sustainability goals and become profitable, the company must make lots of cars that are electric and sporty and increasingly affordable; meanwhile, to prepare for the future, Tesla has to build cars that eventually won’t need us. Some of the most experienced researchers working on A.V.s believe that these are two separate and possibly irreconcilable ambitions and that it makes more sense to focus on a pure driverless car, even if it proves to be a very expensive proposition at first, rather than follow Tesla’s incrementalist policy, which would involve rolling out software on a regular basis until the driver does less and less and finally nothing at all. With the second approach, one Silicon Valley engineer said, “the market pressures that are going to be applied to those technologies mean that you’re not going to climb up the safety and reliability curve” to build a true A.V. Keeping the vehicle affordable is in constant tension with making the vehicle autonomous. Musk’s optimism alone can’t change that.

The first company to succeed at A.V. technology won’t necessarily capture the market in a way that, say, Facebook did with social media. Tesla might have time to make its current strategy work, and it could be that what matters more in the near term are the company’s advantages in batteries and electric vehicles (assuming it can manage the transition to mass-market production). Jurvetson, the early Tesla investor, told me that he thought the company with the best artificial-intelligence systems would come to dominate the auto business of the future. But he did not put a time frame on it, and he did not see it as a winner-take-all prospect. Vivek Wadhwa, a prominent tech entrepreneur and Tesla enthusiast, told me that he sees Tesla’s success prefigured in the smartphone market. “After five years, Tesla will become the Apple in the industry,” he predicted, based on the fact that it is best positioned to capitalize on the potential combination of E.V. and A.V. technologies. But Wadhwa pointed out that phones running on Google’s operating system, rather than Apple’s, are the ones that dominate the world. “Musk will be exactly where Tim Cook will be,” he said. “Tesla will be the iPhone of cars — more elegant, better designed. Maybe even safer.”

Musk declined my interview requests over the course of several months. By early November, the number of Model 3 cars coming out of the factory had fallen far short of what Musk had promised, the company’s stock price had taken a nose-dive and there appeared to be serious software and robotic glitches at the Gigafactory. Musk was said to be too busy to talk, which did not always square with his social-media postings: jokes, poems, photos of tunnels he was digging, links to stories about the dangers of artificial intelligence and, in one instance, footage of a camping excursion on the roof of the Gigafactory.

The company’s evasiveness and secrecy extended to self-driving cars, a subject it was unwilling to discuss in any detail. One Tesla engineer I spoke with, who works on autopilot systems, maintained that the company’s camera and sensory hardware will prove good enough to get his team where it wants to go, which as a near-term goal means cars with a self-driving capability that is twice as good as a human driver (rather than 10 times as good, per the second master plan). By November, Musk was telling investors that the actual goal was to get the system simply on a par with a human driver and that that might require a more powerful computer in the cars, which Tesla would swap in free if necessary. Some customers have already paid $3,000 for a Tesla “self-driving” package (on top of the $5,000 for “enhanced autopilot”), based on Musk’s assurances that the new cars have all the hardware necessary and will be autonomous once regulations and functional software are worked out.

There’s no clear indication of whether these efforts are on track, and in the past year, several engineers who ran Tesla’s autopilot unit have left the company. In early October, Scott Miller, an executive involved with General Motors’ self-driving efforts, charged publicly that Musk was “full of crap” for claiming that his cars could offer self-driving capabilities with their current hardware. His assertions echo those of some other Tesla critics I spoke with: Without Lidar, or a more expensive hardware approach, Musk’s cars may be at a significant disadvantage. Indeed, several people familiar with the company’s A.V. work viewed its self-driving approach as a perilous one, given that there is no definitive way to predict how long it could take Tesla to satisfy the promises made to customers. In the best case, if A.I. and software breakthroughs ultimately transform cars like the Model 3 into self-driving vehicles, Musk will have pulled off something that perhaps seems impossible today. In the worst case, hundreds of thousands of owners will have cars that won’t achieve the status of true A.V.s and can only hope that the sharing network of the master plan will someday become a reality.

Tesla’s setbacks, Musk noted in November, shouldn’t eclipse the fact that the company has already grown faster by some measures than Ford when it rolled out the Model T in the early 1900s. He takes a longer view of his business than Wall Street analysts. In a recent TED interview, while discussing his plans for cities on Mars, he argued that it’s a mistake to assume that technology gets better as time goes on. “It does not automatically improve,” he insisted. “It only improves if a lot of people work very hard to make it better, and actually it will, I think, by itself degrade.” He cited the Egyptian pyramids and Roman aqueducts and how the knowledge to build them was lost for hundreds, or even thousands, of years afterward. The relevance is striking in a time when the federal government would rather subsidize the growth of the coal and fossil-fuel industries than renewable energy and electric cars.

Long before anyone saw Tesla as a legitimate player in the auto industry, Musk also appears to have understood that in taking chances that no established carmaker would, Tesla could be an innovative force to quicken our slow, plodding progress in transportation. Imagine Tesla didn’t exist, Steve Jurvetson told me. “What would the world look like? I have this sinking suspicion it wouldn’t look that different than 10 years ago. A bunch of hybrid cars. A bunch of noise about hydrogen vehicles. You know, I don’t think the world would look anything like today — where entire nations are saying, ‘We’re going to stop making gas cars.’ ”

The company’s impact, real and potential, is all the more surprising considering that Musk has staked Tesla’s success on the industrial equivalent of a shoestring, lacking the resources of established carmakers. He has used customer revenue, his own wealth, venture capital, bank and government loans, investments by other automakers and the American stock and debt markets to effectively fund a multibillion-dollar research-and-development project. In that way, he has led the industry to the start of a new era. And now his company, hindered by debilitating manufacturing bottlenecks and its extravagant promises of self-driving, is poised to find out whether, in laying the groundwork for an electric and autonomous future, he took one risk too many.