Now, both sides say the law is in their favor, setting up a clash that may well end up in court.

President Trump and his administration are working to roll back regulations on businesses. The consumer bureau has been a prominent holdout. When Congress created it six years ago, in the aftermath of the financial crisis, it gave the agency broad powers over a wide variety of financial products, including mortgages, credit cards, bank accounts and student loans.

The consumer bureau is still carrying out the agenda it developed under President Barack Obama, issuing new rules — like a recent regulation intended to curtail sharply the payday lending market — and sanctioning financial companies for practices that it considers unfair or abusive. Nearly 30 million consumers have collected almost $12 billion in refunds and canceled debts because of the agency’s actions.

But the bureau has long been vilified by Republicans as an overreaching, aggressive arm of government.

Now, with President Trump’s support, they have intensified their efforts to curb its power. In a significant blow to the agency, Congress recently overturned a rule that would have allowed millions of Americans to band together in class-action lawsuits against financial institutions.

Installing Mr. Mulvaney, a fiscal hawk who previously called the agency a “sick, sad” joke, as the agency’s interim leader would immediately alter the consumer bureau’s focus.