For a luekemia patient - how does the chemotherapy fixes the bone marrow to not produce immature cells
Chemotherapy in general works by killing (hopefully all) cancerous cells, while leaving the patient / healthy cells alive.
The drugs used for this usually are in principle toxins/poisons, but are more deadly to cancer cells, since these cells are growing very quickly compared to healthy cells. This general strategy is true for a lot of different types of drugs (and cancers). However, because the drugs are still generally toxic they are hard to dose correctly and also the reason why chemotherapy often has quite strong side-effects.
Additionally cancer can quickly evolve to gain resistance to specific drugs, which is why nowadays often a combination of multiple drugs at once is used.

In leukemia - which is a form of cancer where the blood and immune cell precursor cells in the bone marrow become cancerous - additional ways of selectively killing the cancer are radiation therapy (of the affected bones) and in some cases complete bone marrow transplants (which have their own issues, so they are not usually  used as first option).