In his 20 months at the WarnerMedia helm, Mr. Stankey refashioned the division to focus on streaming and dissolved the borders between the conglomerate’s separate units. On his watch, the gregarious longtime HBO chief Richard Plepler left the company and signed a five-year deal to produce shows and films for Apple TV Plus.

Mr. Stankey has had his detractors. Not long after he was named to lead the media business, Elliott Management, one of Wall Street’s biggest and most aggressive hedge funds, bought a $3.2 billion stake in AT&T and sharply criticized its strategy. Elliott took direct aim at Mr. Stankey.

After he was named chief operating officer and president in October, the hedge fund noted with disapproval that Mr. Stankey “would now also be responsible for an additional $145 billion of revenue as the president and C.O.O. of the entire company.”

The tone has shifted since then. Elliott backed off after Mr. Stephenson agreed to some of its suggestions, and on Friday, the hedge fund announced its support of Mr. Stankey’s appointment as chief executive.

“We look forward to working with John as he begins his term as C.E.O.,” said Jesse Cohn, the Elliott partner who led its investment in AT&T.

The timing of Mr. Stankey’s appointment was a surprise. In October, Mr. Stephenson outlined a three-year plan designed to increase the company’s revenue that included his staying on as chief executive through 2020, rather than bowing out earlier, as he had planned. At the same time, the company started searching for a new chief executive, as well as someone to replace Mr. Stankey as head of WarnerMedia. For the WarnerMedia job, AT&T settled on Jason Kilar, the former head of Hulu. He will take charge of that part of the company in May.

The board concluded its search for a new AT&T chief executive this month, much earlier than planned, and decided to announce Mr. Stankey as the new head right away. The company said Mr. Stephenson had said he would remain in the job for a year to give the board time to conduct its search.