Simple answer: Because we've written AIs that work in the digital world, and mines, oil fields, toxic chemicals, and ocean plastic all exist in the real world. If you build a robotic body or arm or some way to do what the people in those places are doing, the AI could control it and do the job.
This is the one potential upside with things like Tesla Optimus. With a sufficiently general purpose bipedal humanoid robot under AI control, that robot COULD work oil fields and mines and toxic chemicals and the like.
However I suspect the miners, oil workers, waste handlers, and ocean cleanup technicians would rather keep their jobs, hazardous or not.