Federline, an aspiring rapper and former backup dancer, was married to Spears for two years. They have two young sons together and divorced in 2006.
"Once you get depressed, you don't really feel like doing anything. You're kind of discouraged about yourself and then the weight gain, too, or that makes me more depressed. I mean, it's a combination of all of those things," Federline told TV's "Access Hollywood."
He also admitted his divorce from Spears contributed to his depression.
"A number of things between, I mean, everybody knows what happened with me and Brit. I'm not going to say that's the total cause of it, but, I mean, just not being happy with myself was probably the main part of my depression," he said.
Federline denied speculation he gained weight to secure a spot on VH1's "Celebrity Fit Club: Boot Camp."
"They called me and they asked me if I wanted to do it and I had maybe 24 hours to decide because the show started taping the next day after that weekend," Federline said. "It just couldn't have come at a better time."
"Celebrity Fit Club: Boot Camp" is to premiere Feb. 8.