I've used the train in the U.K. with no problem, but I don't know what to expect in the U.S. How safe it is to travel via train in the U.S.? For example, is it safe for me to travel from the east coast to the west coast by the train?
I'm assuming you mean onboard. It's perfectly safe.
I've travelled from Washington, D.C. to Chicago, and down to Austin, Texas (two and a half days). I've also done a bit in the Pacific North West, and from NYC to Phily. So I feel I can speak on this a bit.
(I also did a LOT of it in Canada on a coast to coast trip, but that was split up with buses too)
It's actually my favourite way to travel. Buses are cramped, anti-social, and you have awful places to stop and eat. Trains - well the ones I used, often had wifi, comfy seats, were easy enough to sleep on (using two seats, but sleeping sitting up works too), power points at your chair.
In other carriages there were viewing deck carriages with chairs that faced outwards, and snack cars where you could socialise and meet other travellers. People seemed far more open than on buses.
I've done a lot of Greyhound travel in the US, and that was never fun. Some odd types, full on fist fights in front of me, people doing drugs, and buses breaking down (these were just the worst cases, not every trip). The train ran late into Austin, but that was about it.
For reference, there seems to no longer be a direct coast to coast, which was what I planned too. I took the Capitol Limited from DC to Chicago, and then from Chicago I took the Texas Eagle down to Austin, and then if you continue on that it does end up in Los Angeles. Not much of a picture, but this has a description of the features.
Safety wise, I never felt unsafe, and sure, an opportunist might have pick-pocketed me while I was asleep if they were really good, but I've usually locked up my bags or have them under my feet if I'm dozing anyway.
If you actually mean the trains themselves, there was an Act of Law passed in 2008 to improve the safety of rail throughout the US, to force rail companies to adopt measures to further improve their systems.
Rail safety in the US is a far cry from the images of the old movies. Just about all long-haul passenger operation in the US takes place on signaled lines protected by interlocking and under the watchful eye of a dispatcher at a desk (what's known as Centralized Traffic Control or CTC for short). The dispatcher will have a computer terminal in front of him that enables him to see roughly where trains are at any given time as well as direct them by throwing switches (so that passing, meets, and such can be implemented). If something were to go wrong (such as a stuck train, a signal failure, or the dispatcher trying to do something he shouldn't), the interlocking system itself will ensure that a safe state is maintained, dropping signals to red as needed. This is similar to modern power signalbox operation in the UK, with dispatchers performing the function of UK signalmen. In addition to this, higher-speed lines in the US (the Northeast Corridor, and some commuter and regional lines) universally use automatic train protection technology, and there are efforts underway to bring this to all passenger-carrying rail lines.
Furthermore, current US passenger rail equipment is built to an extremely stringent crashworthiness standard; Branson's line in the aftermath of the Grayrigg derailment about the Pendolino rolling stock being "built like a tank" would quite readily apply to the crashworthiness performance of US passenger rail cars as well.
The trains are safe - at least they're more or less as safe as the UK. I was going to cite some statistics here, but it turns out it's complicated comparing modes of transportation.
What you should know, however, is that they're often ludicrously late. The railroads would rather not be in the passenger business, and unlike most anywhere else in the world, the passenger trains have to 'step aside' for the freights. Lots of Americans have never traveled on a train in their lives.
The exception is urban commuter lines and 'corridor' service. Those are usually on time or near it.