Aaron Hernandez was gay -- according to several people close to him ... and his private struggle with his sexuality caused him great emotional pain that may have turned him violent.

It's all part of the Oxygen documentary, "Aaron Hernandez Uncovered" -- which features interviews with Aaron's close friends, ex-girlfriends and members of his legal team.

Aaron's college girlfriend, Alyssa Anderson, says she first learned Aaron had a relationship with a man while they were attending the University of Florida ... but he denied it at the time. It was only years later that Hernandez cryptically acknowledged her suspicions were true.

George Leontire -- an openly gay member of Hernandez's defense team -- says he spoke with Hernandez at length about his sexuality and Aaron opened up like never before.