I have hypothyroidism, and interestingly, hypo patients are often misdiagnosed as bipolar before they are properly diagnosed with hypo.
Once properly treated, the mood swings go away and docs find that we were never really bipolar at all. The drugs that treat bipolar disorder actually make hypo worse, and smoking tends to stave off hypo symptoms, so when I quit smoking the first time I was a real joy to be around, let me tell you.
I also have fibromyalgia, which can lead to depression.
I think any chronic disease can lead to some mental issues simply from the isolation it brings, though, since most of my contact with the outside world comes from the internet. I was a very gregarious person in my former life and living like a hermit is a big change.