WASHINGTON—Acting Navy Secretary Thomas Modly resigned Tuesday after an uproar over his verbal attack on the former captain of the virus-stricken aircraft carrier Theodore Roosevelt, in a saga that has dealt a new blow to a U.S. Navy beset by missteps and clashes with the White House in recent years.

Mr. Modly was under pressure to resign after an extraordinary chain of events over the past two weeks as the Navy and the U.S. military scramble to respond to the Covid-19 crisis, with more than 230 cases on the aircraft carrier and more than 1,500 across the armed services.

Defense Secretary Mark Esper accepted Mr. Modly’s resignation Tuesday after top officials held a series of meetings at the Pentagon on Tuesday morning.

With President Trump’s blessing, Mr. Esper said in a statement, he tapped Under Secretary of the Army James McPherson, a retired Navy rear admiral who once served on the Theodore Roosevelt, to succeed Mr. Modly, officials said. Mr. Modly is expected to depart in the next day or two, officials said.

“He resigned on his own accord, putting the Navy and the sailors above self,” Mr. Esper said in a statement.