WASHINGTON — Rick Perry, the former Texas governor and President-elect Donald J. Trump’s nominee as energy secretary, said in his Senate confirmation hearing on Thursday that he regretted having recommended the abolition of the Energy Department in the past.

He addressed his awkward history on the issue up front, telling the Senate Energy and Natural Resources Committee that after “being briefed on so many of the vital functions of the Department of Energy,” he no longer believed, as he said while running for president in 2011, that it should be eliminated.

Mr. Perry also offered a full-throated reversal of his views on the science of human-caused climate change, which he called a “contrived, phony mess” in a 2010 book.

“I believe the climate is changing,” he said. “I believe some of it is naturally occurring, but some of it is also caused by man-made activity. The question is: How do we address it in a thoughtful way that doesn’t compromise economic growth, the affordability of energy or American jobs?”

Mr. Trump, by contrast, has called climate change a “hoax” and has continued to express doubts about established climate science.

Mr. Perry also appeared to signal a somewhat different position from Mr. Trump on nuclear weapons policy, the Energy Department’s chief portfolio.

Mr. Trump has said the United States must “greatly strengthen and expand” its nuclear capability, “Let it be an arms race,” he said.

But Mr. Perry, asked by Senator Bernie Sanders, the Vermont independent, whether he believed expanded testing of nuclear weapons was a “dangerous idea,” replied, “I think anyone would be of the opinion that if we never have to test another nuclear weapon that would be a good thing for the world.”

He added, “I think nonproliferation is a good thing.”

Asked if he would support the Iran nuclear deal — which Mr. Trump has derided and which was largely negotiated by the current energy secretary, Ernest J. Moniz — Mr. Perry said he had not received classified briefings on it.

“If D.O.E. has a role to make sure that Iranians are living up to the deal, message delivered, sir,” Mr. Perry said to Senator Al Franken, Democrat of Minnesota.

Last month, when Mr. Trump offered Mr. Perry the job of energy secretary, he accepted with the understanding that the role would be largely focused on promoting American energy development, according to people who have briefed him. Only later did he learn that the agency’s central portfolio is the oversight and management of the nation’s nuclear weapons complex, as well as 17 national scientific laboratories.

“This confirmation process has been extremely informative and beneficial for me,” Mr. Perry said, citing his conversations with Mr. Moniz, a nuclear physicist.

He highlighted his experience as an Air Force pilot from 1972 to 1977 as among his qualifications to oversee the nuclear weapons complex.

Mr. Perry is expected to be easily confirmed by the full Senate. But Democrats pressed him sharply on his views on climate science, noting that the Energy Department is a major science agency, with thousands of research scientists across the country. Democrats expressed concern that his past views, so at odds with established mainstream science, could be a serious impediment.

They also pressed him on reports that Mr. Trump’s team is considering making cuts to the Energy Department’s offices of energy efficiency, renewable energy and fossil energy. The last is focused on research to lower planet-warming carbon emissions.

Mr. Perry said he was unaware of such reports.

“Maybe they’ll have the same experience I had and forget that they said that,” he said to laughter, referring to the moment in a 2011 presidential debate when, asked which agencies he wanted to eliminate, he could not recall the name of the Energy Department. What Mr. Perry later called his “oops” moment was widely seen as sinking his campaign.

Senator Maria Cantwell of Washington, the panel’s top Democrat, said, “Like many of my colleagues, I am deeply concerned by some of the things that Governor Perry has said in the past about climate science.” She added: “The Department of Energy’s scientific horsepower is key to understanding these trends. I hope you can understand there is widespread anxiety about President-elect Trump’s intention to dismantle these scientific capabilities or simply just starve them for resources.”

Ms. Cantwell pushed Mr. Perry on whether he would protect the agency’s budget for climate science.

“I’m going to protect all the science, whether it’s related to climate and all other aspects of what we are doing,” he replied.

Ms. Cantwell also asked Mr. Perry about a questionnaire sent to Energy Department employees by Mr. Trump’s transition team that appeared to target the agency’s climate science research.

Mr. Perry disavowed the questionnaire, saying it was sent out before he was selected as the nominee. “I didn’t approve it, I don’t approve it, I didn’t need the information, I don’t want that information,” he said. “That’s not how I manage.”

The hearing was leavened with some humor. Asked by Mr. Franken, who had earlier pushed him sharply on nuclear weapons and climate change in his Senate office, “Did you enjoy meeting me?” Mr. Perry responded, “I hope you are as much fun on the dais as you were on your couch,” before adding, “May I rephrase that, sir?”

“Please. Please,” Mr. Franken replied. “Oh, my Lord. Oh, my Lord.”

“Well, I think we’ve found our ‘Saturday Night Live’ sound bite,” Mr. Perry said.