"How could this happen?" people ask.
Hey, these people are just people. They line the switch wrong every now and then. Most of the time, someone sees it or the switch is thrown to the right track again before it becomes a thing.
Nobody is infallible (though some think they are). Heck, I once saw a very experienced Special Forces solider do something horrendously stupid with a weapon, something you'd never expect even a new recruit at basic to do, but people are people. Sometimes, they zig when they always should have zagged and knew better.
Doesn't make it any easier for the people who were killed and their families, but railroad employees aren't gods. They do dumb things sometimes.