Why is there a の after 水泳の授業で?
This の is a plain possessive particle. 水泳の授業で directly modifies 新型コロナウイルス. で is the location particle and is used to specify where Coronavirus is happening. Therefore「水泳の授業での新型コロナウイルス感染」means "Coronavirus infection in swimming class." See this related question for more information: using の with と,で, から, まで
Why don't we use をなった here? Also, what is the function of ため here ("for" seems not to make sense?)?
をなった won't work here. となる is a variant of になる. See this question for differences between two: What is the difference between 〜となる and 〜になる?
ため here is used to specify the reason why 水道料金 came to light (発覚した). ため has two meanings: in order to (or "for" like you mentioned) or because/since.