Those other people might be using a different network, may not be on the internet, etc.
On trains in the UK, you often travel up to 140 mph. At that speed, it is almost impossible for your phone to keep a network connection with the phone masts nearby.
When a phone connects to a mobile phone mast, it broadcasts its information then waits for a reply from the phone mast. This is called a handshake. After that, it authenticates itself with the giffgaff/O2 network.
This handshake & authentication takes approximately 5-15 seconds. Often, at the speed that trains move, the phone needs to do this multiple times per minute as it quickly disconnects and connects with phone masts it passes. This is the reason that phones should be switched onto aeroplane mode when on a plane -- (when you're at a low altitude) you're simply going too fast to connect to the mast! It also causes a lot of stress on phone masts when you're quickly connecting and disconnecting.
It could also be a lack of service in the area around the train lines.In a nutshell, you're going too fast on the train to maintain a stable connection with the phone masts. If you have an emergency in your car you will likely stop so will maintain this connection. There may also be a lack of phone masts in the vicinity of the train tracks (quite possible in the countryside). Most trains in my area (Southern, Thameslink, Gatwick Express) have onboard WiFi anyway (maximum 50 or 100 MB though) so you could give that a try.
NOTE: I have simplified some of this. If you're a telecoms expert, sorry!
If you still need help, feel free to reply to my message and mention me by adding "@mrjeeves" to your message.