Aaron Hernandez killed himself largely because he was suffering from CTE -- and NOT because he was agonizing over his sexuality ... so says his famous attorney.
Jose Baez -- who repped Aaron and helped him beat a double murder case -- tells TMZ ... the new documentary about his client implies Aaron was in the closet, and might have even taken his life because of that alleged secret.
That's just not the case, though, according to Baez ... who says Aaron's death was triggered by advanced CTE -- a brain disease the tight end had developed since his youth. Baez insists Aaron's sexual orientation played ZERO part in his fate.
You'll recall ... Baez was intent on getting Aaron's brain studied at Boston University, and even accused the Worcester Medical Examiner of holding onto it illegally. He also downplayed rumors his client had a love affair with a fellow inmate.