Driverless subway and shuttle trains have existed for decades. The first I remember riding was the Denver airport train in the 1990s. That’s obviously a simple scenario, they are on closed circuits without any other vehicles or pedestrians.
As for freight trains, I googled, and they are in the works, but it seems with much less activity than with trucks.
Maybe the labor savings is limited? Trains are not numerous compared to trucks.
Also the opportunities for wrecking are fewer. There are controllers watching the traffic and working switches to prevent collisions.
Popular Mechanics – Oct 2, 2017 – Self-Driving Freight Trains Are Now Traveling the Rails Without a Human on Board
Australian mining company Rio Tinto has been running trains in autonomous mode since the beginning of 2017, and as early as July, it said that around 20 percent of train runs were being completed autonomously. But all of these trains had drivers aboard as a failsafe, until now. For this most recent trip, the train completed an entire leg of the journey without a human onboard at all.