I can't see how infrantry can counter air?

Infranty attacking air causes medium damage (yellow indicator) and air attacking infrantry causes again … medium damage.
So thats 50/50 even … so how does it counter? unless upgraded marines with rockets turns it to green damage?

The damage color is just how that unit will fare when it is attacking other units types. The rock-paper-scissors aspect of HW2 takes precedence. Certain unit types have different armor and damage multipliers against other unit types. So elite rangers, even though they’re red against air, can still do a decent job at killing air units because infantry beats air. This mechanic is also why counter units are sometimes beaten out by the very units they are supposed to counter. For example, Reavers counter Hornets but if those Hornets strongly outnumber the Reavers or are ahead of them in upgrades, they can win the engagement because air beats vehicles. So remember, air beats vehicles, vehicles beat infantry, and infantry beats air.