Mr. Cohn was familiar with Mr. Trump’s nationalist stance on trade, and the president repeatedly asked aides, “Where are my steel tariffs?” over the last eight months. Since last summer, a process for debate and information flow to the president had been in place as he made decisions. But that process has been in tatters since Mr. Porter left the White House, several aides said on Tuesday.

What’s more, people close to the president said, Mr. Cohn had harmed his own ability to negotiate by telling Mr. Kelly last week that if the tariffs went forward, he might have to resign. The president was told by Cohn critics that Mr. Cohn had made the issue about himself, as opposed to Mr. Trump’s policies. That led to Mr. Trump souring on Mr. Cohn by the time his resignation was submitted on Tuesday. But the president was still infuriated by Mr. Cohn’s decision, according to multiple people who discussed it with the president after it was announced. In several conversations that Mr. Trump had with people on Tuesday, he denounced Mr. Cohn as a “globalist.”

The resignation followed conversations Mr. Cohn held with the president in recent weeks about the possibility of replacing Mr. Kelly as chief of staff, said people who were briefed on the matter. The president never formally offered Mr. Cohn the job, those people insisted, but Mr. Trump had discussions with him about whether he would be interested.

On Tuesday, before Mr. Cohn’s announcement, Mr. Trump dismissed talk of chaos in his White House while acknowledging that he deliberately fostered a fractious atmosphere. “I like conflict,” he said at a news conference with the visiting prime minister of Sweden. “I like having two people with different points of view. And I certainly have that. And then I make a decision. But I like watching it. I like seeing it. And I think it’s the best way to go.”

But he insisted that he had no trouble recruiting or retaining people to work for him, despite widespread reluctance among Republicans to join his staff.

“Believe me, everybody wants to work in the White House,” he said. “They all want a piece of the Oval Office. They want a piece of the West Wing.”

People close to Mr. Cohn said that he had planned to stay for roughly a year, and that he had accomplished a number of things he cared about, including the $1.5 trillion tax cut.