WASHINGTON — The first time Donald J. Trump met Senator Tom Cotton, in summer 2015, the two commiserated over their shared hatred of the nuclear deal that President Barack Obama had just struck with Iran.

Mr. Trump, at the time a presidential candidate who knew little about national security, thanked Mr. Cotton, an Ivy League-educated Iraq war veteran and then a first-year senator, for his staunch opposition to the agreement. Mr. Cotton, who described the encounter in a recent interview, had written an unusual letter to Iran’s mullahs, signed by 46 Republican colleagues, warning that Congress might reverse the nuclear accord or a new president might rip it up; Mr. Trump was campaigning on doing just that.

Now Mr. Cotton, 40, is Mr. Trump’s favorite to lead the C.I.A. as part of a quietly conceived plan to elevate the current director, Mike Pompeo, to replace Rex W. Tillerson, the secretary of state who has lost favor with the president and his closest advisers.

Should the plan hold and he be confirmed for the post, Mr. Cotton, the youngest member of the Senate, would also be the youngest person ever to lead the nation’s premier intelligence agency. Serving as C.I.A. director would seal his reputation as a young man in a hurry in Washington, underlined by his lack of experience relevant to the job.