While modern trains won't litter the tracks with human excrement, the traditional method did just that. This is what was known as a hopper toilet. It could either be a simple hole in the floor (also known as a drop chute toilet) or a full-flush system.
In the absence of washrooms inside loco cabins and strict directives never to leave the engine unattended, a train's pilot, if he wishes to use the loo, has to send this message to the control room, which then makes arrangements for his replacement at the next major railway station.
This answer applies to American practice. American freight trains do not have sleeping quarters. In the past (mostly ending in the 1980s) each freight train had a caboose on the rear end. This was basically an office but could have bunks and a stove that could be used for cooking.
Modern locomotives are air conditioned but many older ones are not. Individual freight cars may be refrigerated or heated, depending on the needs of what they carry.
Only sleeper car passengers have access to the showers. They are located in the sleeper cars on the lower level in Superliner train cars on down the hall on the Viewliner train cars. Amtrak provides a few items for you and the room attendant keeps the shower clean.
So they err on the side of caution, and instruct you not to drink the water, because they can't guarantee that it's potable. Even if the water is great when it goes in, it sits around in an unrefrigerated tank that doesn't get a thorough cleaning every day. That alone is enough to disqualify it for drinking.
Conductors and engineers sleep at home or at a hotel at their away terminal. The operating crew of a train in the US can only be on duty for 12 hours and then must be relieved.
Some trains may have composting toilet tanks, which use bacterial action to break down solid and liquid waste. Only the broken down clean liquid is released to the trackbed after sterilisation. The solid waste only has to be emptied every half year.
What do freight train engineers (drivers) eat for lunch? Do they have to bring their own, or does the railroad figure out a way to feed them? Freight train engineers typically bring their own meals or purchase food at train stations or nearby convenience stores.
How do train drivers go to the toilet? Longer distance trains have 2 engineers, and a toilet. So when you have to go, you just let the other person operate. Or on other lines, they may just stop the train, and go use a bathroom when needed.
We often get the question “Is Amtrak safe for single woman”, the short answer is yes. You are in a train car full of people. One of the great things about Amtrak is the space. On airplanes the seats are so close together that it's hard to avoid touching your seat mates.
If you're traveling in coach on some of Amtrak's long-distance train services, you'll now have the opportunity to use the dining car onboard. Coach passengers will now be able to enjoy full-fledged meals for an additional cost in the dining car, which was a beloved service removed during the COVID-19 pandemic.