Given a choice between "which" and "in which", "in which" is less wrong.
Better options exist. I would consider options such as "whereby", "due to which", "during which" or even "from which" as more reasonable than "in which".
However, the point of the test question is that "which" by itself does not work.
On its own, "which" is a pronoun. Specifically, it's a relative pronoun, so it must refer to something earlier in the sentence. In theory, it could refer to either "lungs" or "infection". In this case, it refers to "infection", because "lungs" appears again in the subordinate clause. We can't make much sense of "lungs filling lungs".
The pronoun has to play a role in its clause. It could be a subject, an object, or a complement. The clause has the verb "fill", so we should check those roles in relationship to that verb.
The verb "fill" doesn't license complements, so we can't even examine that option. It's simply not available.
If "which" were a subject, it would be immediately followed by the verb. The clause in question would look like "which fills the lungs with fluids". The blank is in the wrong place for this, so "which" can't be a subject.
If it were the verb's object, it could precede the subject and the blank is in the right place: "which the lungs fill with fluid." However, this would mean the lungs fill the infection with fluid. Although that's grammatically fine, it simply doesn't make sense.
An infection isn't the kind of thing that can be filled with fluid. Lungs are tangible, concrete, and able to act as containers. An infection is intangible, abstract, and unable to hold anything.
All that's left is for "which" to be the object of something else. In the phrase "in which", the "which" is the object of a preposition.
In this test question, the verb "fill" doesn't offer "which" any sensible role to play. The preposition "in" does offer a role, and the prepositional phrase "in which" can play the role of a modifier of the verb "fill".