Hendoku iyaku means changing poison into medicine: a trouble that could damage you becomes the material for growth.
Hen means to turn, doku is poison, i is into, and yaku is medicine. The phrase is used for the way practice changes your relationship to difficulty, not for the idea that suffering is good.
Nobody chooses the poison. Failure, loss and conflict arrive without permission. What the teaching offers is a different use for them. The same event that narrows a life can, over time, deepen it.
This is not a promise that everything works out. Some things do not. The claim is smaller and more honest: nothing has to be wasted.
Imagine a business that fails. For a year it is only a wound. Then, slowly, you notice what you learned about your own limits, and what you want to do differently. The failure has not become good. It has become useful.
Read changing poison into medicine, or karma.