As Mr. Kelly walked toward a hallway leading back to his office, he called to someone to remove Mr. Lewandowski from the building. The two then began arguing, with Mr. Lewandowski speaking loudly. Mr. Kelly grabbed Mr. Lewandowski by his collar, trying to push him against a wall, according to a person with direct knowledge of the episode.

Mr. Lewandowski did not get physical in response, according to multiple people familiar with the episode. But Secret Service agents were called in. Ultimately, the two men agreed to move on, those briefed on the episode said.

Still, people in the West Wing who learned at the time what had happened were stunned.

In the months since the altercation, Mr. Lewandowski has traveled frequently with Mr. Trump aboard Air Force One to his political rallies and has continued to meet frequently with the president in the White House, though West Wing aides now try to make sure he steers clear of Mr. Kelly’s corner of the West Wing.

He is also writing a book, “Trump’s Enemies: How the Deep State Is Undermining the Presidency,” which is scheduled to be published in the weeks after the election and which some in Mr. Trump’s circle fear will take swipes at some of his aides.

On the other hand, Mr. Kelly, who is called “the general” or “the chief” by his allies inside the West Wing, is widely seen as a diminished presence among the president’s advisers. Though Mr. Kelly has repeatedly said he expresses his honest opinions to Mr. Trump, he has shown little inclination or ability to curb some of the president’s impulses.

He is not the first chief of staff to struggle with his image inside and outside the White House: Administration observers compare Mr. Kelly to Donald T. Regan, President Reagan’s former chief of staff, who amassed power in the West Wing only to squander it in clashes with other advisers and the president’s wife.

With his legacy in mind, Mr. Kelly tends carefully to his press coverage, and keeps his eye on those he considers to be friendly to him in print and on the broader White House staff, according to multiple current and former aides. The president, who publicly maintains that his West Wing runs like a well-oiled machine, recently invited a reporter for New York magazine — along with his vice president, secretary of state and Mr. Kelly — into the Oval Office to show just how much faith he has in his chief of staff.