Change the voice: Why did you discourage them?
Change the voice: Why did you discourage them?
Explanation
The sentence is in past simple tense (did discourage) — passive form becomes was/were + past participle.
So, correct passive structure: "Why were they discouraged by you?"