WASHINGTON — President Trump enters a new phase of his presidency on Monday with a new chief of staff but an old set of challenges as he seeks to get back on course after enduring one of the worst weeks that any modern occupant of the Oval Office has experienced in his inaugural year in power.

With his poll numbers at historic lows, his legislative agenda stalled and his advisers busy plotting against one another, Mr. Trump hoped to regain momentum by pushing out his top aide, Reince Priebus, and installing a retired four-star Marine general, John F. Kelly, to take command. But it is far from certain that the move will be enough to tame a dysfunctional White House.

The shake-up followed a week that saw the bombastic, with-me-or-against-me president defied as never before by Washington and its institutions, including Republicans in Congress, his own attorney general, the uniformed military leadership, police officers and even the Boy Scouts. No longer daunted by a president with a Twitter account that he uses like a Gatling gun, members of his own party made clear that they were increasingly willing to stand against him on issues like health care and Russia.

The setbacks came against the backdrop of a West Wing at war with itself, egged on by a president who thrives on conflict and chaos. Mr. Kelly, who had been serving as secretary of homeland security, brings a career of decisive leadership to his new assignment as White House chief of staff. But he confronts multiple power centers among presidential aides, all with independent lines to the man in the Oval Office who resists the discipline and structure favored by generals.