For the most part, it doesn't matter which way a modern locomotive faces, it works just fine either way. Typically though, the main reason some locomotives will be facing backwards is because turning trains is not always easy. In the past, you would need a wye, loop, or turntable to turn a train/locomotive around.