Contract = you receive the virus/illness.
"You will contract corona virus if you don't wear a mask"
Infect = you give the virus to someone else.
"Don't stand near sick people, they could infect you."
"Don't come near me, I have a virus, I could infect you."
"I became infected" and "I contracted the virus" have the same meaning