It's a surgeon AI
Before the malfunction, this AI worked as a surgeon in a team with either other AIs or humans, so many tasks at the operating table were being done by other parties, i.e. anaesthetics. The AI could have been highly specialized, for example to have its only function be removing cancer cells from patient's heart. Once patient was given the anaesthetics and someone/something else made a cut in patient's chest to expose the heart, the AI just reached inside and cut out the cancer cells with precision not possible for a human surgeon. So what can the AI do:
1. Cut out heart cancer cells when everything has already been prepared for it to do so.
What can't the AI do:
1. Keep patient in proper position (lying on their back, not moving/reacting due to anaesthetics).
2. Make sure other organs on the way aren't damaged (the heart should be exposed before AI starts its work).
3. 115
Detect if patient actually has cancer (the patient will be on this AI's operating table only if he was checked/scanned before and heart cancer was detected).
4. Correctly decide when and on whom it should begin the operation (that part was controlled by Human-designed Personality, which was given the order by a human once patient was ready to be operated on)
You can have some variety here, AI could also be responsible for whole operations on patients, not just the cutting-out-cancer part, so only point 3 and 4 would apply. Maybe it wasn't working with cancer cells, or maybe not in hearts? I just went with the heart because its damage will has very high chance to be fatal.
So what is the AI trying to harvest?
Cancer cells, either for later disposal or for research that would help create cure for cancer. Alternatively it could operate on the premise, that there's a certainty that this human's heart has cancer cells. Since it can't detect any cells that are different than the others it must mean that 100% of the cells in heart are cancerous and the AI decides to remove the whole heart. AI can recognize humans and human hearts which are what it was supposed to work with, so it doesn't go after dogs or cats.
What else does it harvest, so that people can realize why it's killing people?
Items necessary for maintaining its operating equipment, either to sharpen its cutting blades or disinfect them. Also scalpels as replacements, but it would curiously leave larger blades/knives untouched. Maybe if AI's role was actually to perform the whole surgery (and not just cutting out the cancer cells), it would also look for anaesthetics (but if none are available, it would just skip anaesthesia and proceed with the rest of the operation as normal). As a bonus with full-operation-capable you could have someone survive an encounter with the AI, because he actually had heart cancer and the AI simply performed a regular surgery on him, removing the cancer cells without cutting out the heart entirely). 115