Mr. Nadella, who joined Microsoft in 1992, touched on a range of topics during the talk in Manhattan, discussing privacy, gaming, immigration and the effect of artificial intelligence on jobs.
Mr. Nadella said that immigrants — and not just those with highly valued skills — help improve competition. He said he himself had benefited from “enlightened” immigration policy that allowed him to study and work in the United States.
“That’s what makes America exceptional, both being the place where the talent comes and also being the beacon of hope for the people who need hope,” said Mr. Nadella, who early in his employment at Microsoft had given up his green card for a temporary H-1B work visa that allowed him to bring his wife, Anu, to the United States from India.
Like many tech companies, Microsoft has voiced opposition to President Trump’s decision to begin rolling back the Deferred Action for Childhood Arrivals immigration policy. Microsoft said it would cover the legal costs for any worker threatened with deportation.
Mr. Nadella also addressed a series of business flops — including a disastrous acquisition of the phone maker Nokia and Microsoft’s late start in development of cloud computing services — that pushed it out of the top tier of white-hot tech companies like Facebook, Apple and Google.
But recently, Microsoft has regained traction, making some of the most innovative personal computers in the industry, experimenting with artificial intelligence and augmented reality and testing autonomous vehicles. Microsoft’s share price has more than doubled during Mr. Nadella’s tenure as chief executive.
But there is still room to grow. Revenue from Microsoft’s Azure cloud service soared 97 percent in its fourth quarter, but the business still lags behind the offering of its nearby rival, Amazon.
Mr. Nadella said that companies cannot expect to “hit every trend or catch every wave,” noting that Microsoft faced “a new existential threat” every five years throughout its history. He said that while “zero sum competition” exists in the industry, he also values partnerships.
Amazon and Microsoft, based a short drive apart in Washington State, compete for both talent and business. But the two companies recently paired up to integrate Amazon’s Alexa voice-controlled digital assistant with its Microsoft counterpart Cortana.
“I do not view it primarily through a competitive lens — technology today is much more pervasive, and the top five companies by market cap are all very different,” he said. “The worst mistake I can make is to assume that we should do what they’re doing and not be true to our identity.”
Mr. Nadella is promoting his new autobiography, “Hit Refresh,” which went on sale on Tuesday.