感染 means 'become infected' while 传染 means 'spread virus towards'. Therefore, the former is the result of the latter. For example,
我感染了病毒,因为我被同事传染了
Wǒ gǎnrǎnle bìngdú, yīnwéi wǒ bèi tóng shì chuánrǎnle
I become infected virus because I was colleague spread virus
'I caught the virus because I was infected by a colleague.'