How/when did Chen Li find out Xiaozhi  was gay? In episode 5, everything seemed fine, then all of a sudden, he just didn't come back from getting medicine. 

He didn't necessarily know back then. Probably he found out in heartbreaking scene at the end of ep. 5.

I'm sharing a comment from someone on reddit for further explanation of the same question.
"The director wrote about this somewhere (weibo? can't remember). Chen Li couldn't make it back to the camp because that's when his dad got sick. He's been taking care of his dad / been by his side ever since then, even when he went to pick up Xiao Zhi from college after the fight with his roommates. CL made up that line about having to check on something for his girlfriend because at that point CL wasn't ready and didn't want XZ to realize XZ meant so much to him that CL left his dying dad's side to help XZ " - comment by u/Remote-Disaster2093 in this thread .