Mr. Grewal made his mark in criminal justice with significant federal convictions in financial and cybersecurity crimes, including a case involving two Russian hackers named Drinkman and Smilianets, who oversaw a network that stole more than 160 million credit card numbers.

But in today’s political climate, attorneys general in Democratic states are increasingly being viewed as checks on Trump administration policies.

Just across the Hudson River, Eric T. Schneiderman, the attorney general of New York, has been an aggressive challenger to many of the policies coming out of Washington. Mr. Grewal said that he received a congratulatory call from Mr. Schneiderman this month, and that he looked forward to a “collaborative relationship,” though he refrained from saying whether he would join in any pending cases, only allowing that he would make such decisions when he takes office.

While Mr. Murphy promised to not pressure or interfere with Mr. Grewal, partisan entrenchments have largely transformed the position of statewide attorney general, ostensibly an apolitical position, into an inherently political one.

Mr. Grewal, the current Bergen County prosecutor, said he wasn’t concerned about politics.

“Yeah, I mean, but so what?” Mr. Grewal said when asked about whether taking action contrary to Washington could be construed as political. “Because you’re seeing people today, it’s just unconscionable, that their loyalty and their patriotism is being questioned because of what they look like, where they come from, what they believe. And, you know, that’s the same thing we did in 1942. That’s why I have those pictures on the wall.”