Bergdahl disappeared from his base in Afghanistan in June 2009 and was held in captivity by the Taliban until May 2014.
"I left my observation post on my own," Bergdahl told a judge Monday. "I understand leaving was against the law."
The 31-year-old said he deserted from his outpost to try to reach the base from where he was dispatched. Bergdahl told the judge he wanted to report "a critical problem in my chain of command," but did not specify what that problem was.
There was no pre-trial agreement prior to Bergdahl's guilty plea, both the government and defense said.
Bergdahl faces up to five years in prison for the desertion charge and up to life in prison for the charge of misbehavior before the enemy.
The judge, Army Col. Jeffery R. Nance, said Bergdahl's sentencing hearing will begin October 23.
Torture after desertion
Hours after Bergdahl deserted, he was captured by the Taliban. During his captivity, the sergeant made "somewhere between a dozen and 15 escape attempts," Bergdahl said during his hearing Monday.
He previously described the torture he endured
, which included months chained to a bed and years either locked in a cage or chained on all fours.
After five years, the Taliban released Bergdahl in a prisoner swap for five detainees at Guantanamo Bay. Since then, he has been called both a traitor and a hero
In 2015, an Army Sanity Board evaluation said Bergdahl had schizotypal personality disorder
. That information was included in the hundreds of pages of documents that Bergdahl's defense team released on a website called The Bergdahl Docket
Trump: Bergdahl 'should be shot'
During the 2016 presidential campaign, Donald Trump said Bergdahl "should be shot" for walking off his post.
"In the good old days, he would have been executed," Trump said.
After Trump became President, Bergdahl's lawyers argued the judge should dismiss the charges because of Trump's comments, claiming Trump violated Bergdahl's due-process rights and saying it would not be possible for Bergdahl to get a fair trial.
But a military judge ruled against dismissing charges. Bergdahl later chose to be tried by a military judge rather than a jury.
In an exclusive interview obtained by ABC last year, Bergdahl said he didn't think he would be able to get a fair trial after Trump's comments that he should be shot.
"We may as well go back to kangaroo courts and lynch mobs. They got what they wanted," Bergdahl said. "People who are to the point of saying, 'Yeah, just shoot him' -- you can never convince those people to change their minds."
Retired Army Spc. Cody Full, a member of Bergdahl's platoon in Afghanistan when he disappeared from the base, called Bergdahl a "coward" in an interview with CNN.
"He was a coward nine years ago when he deserted, and I think he showed he's still a coward," Full said. "He refuses to take responsibility for his actions."
He said the military has an open-door policy for service members to voice concerns about chains of command, so it wasn't rational for Bergdahl to do what he did.
"He literally put thousands and thousands of people's lives at risk," Full added, "just so he could go and want to complain for whatever transgressions he thought happened or didn't happen."