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 .

 what:

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 .

Thank you for this comment, I didn't realize THAT was the reason why he never came back to Xiao Zhi. 

It was clear to me that Chen Li found out XZ was gay at the end of ep5, because although we mostly saw his back in that scene, the pain and anguish he felt were so intense, like it was an implosion: him finding out XZ really was in love with him so he hadn't been imagining things... but I didn't really get the father's disease part, which somehow felt a bit abrupt to me, so thank you!