In general, insurance is a net good for you when it covers catastrophic losses that you would otherwise be unable to properly pay for yourself. See more here: https://money.stackexchange.com/a/77570/44232. Of course, insurance is more valuable when the catastrophic event becomes more likely. The list of possible outcomes for this combination of expense + likelihood is below:
1) Unlikely event; minimal loss: Insurance has no value here; you will simply be giving money to the insurance company and never getting anything worthwhile in return. Example: insuring your car in Florida against hail damage.
2) Unlikely event; catastrophic loss: Insurance has some value; it is likely cheap to acquire due to unlikelihood of occurrence, and could reduce the possibility of unfortunate incidences from becoming life-altering. Example: insuring your car for an extra $1M liability insurance against possible medical expenses of those in an accident.
3) Likely event; minimal loss: Insurance has no value here - you will over the course of your life suffer many of these small losses, and by constantly paying insurance, you are on average losing money to the insurance companies. Example: insuring your toaster.
4) Likely event; catastrophic loss: While insurance would be valuable here, it is also going to be quite expensive. A better option may be to simply not participate in that activity. Example: insurance for participating in an unlicensed MMA fight.
Your specific question refers to what I would classify as #2 above - an unlikely event, but a catastrophic loss. This implies that insurance may be worthwhile, depending on the price and payout. The price itself seems small in relation to the cost of a ticket, and the payout seems high in relation to the cost of the premium.
But does the payout actually mean to you? It is perhaps not wise to consider life insurance as a 'windfall payment'. Instead, consider life insurance as coverage for the financial realities of death - funeral expenses, and perhaps money to provide grieving time for your family before they resume or take on work [Again, insurance is coverage against catastrophic loss, not a lottery ticket to provide a windfall when the unfortunate happens]. If you are the sole provider for your family, you may also want your insurance payout to be enough to resolve any outstanding debts you have outstanding [such as a mortgage], and/or substantially cover living expenses for your family for an extended period of time. A $20k payout would likely be far more than enough to cover funeral expenses, but may not be enough to set up your family to subsist without you as a sole provider.
Also consider that the chance for an accident may not seem particularly concerning while you are on the train in comparison to when you are jaywalking, or smoking the odd cigar, eating red meat, having a glass of red wine. What I mean is that there are many things in life which add some level of risk; not all of them are as obvious as a train ride, but there is always a chance of something unfortunate happening, even if you take reasonable precautions.
What these two considerations imply is that perhaps instead of insuring against this very specific incident, you instead purchase overall life insurance.
Rather than taking a flat payout amount, take enough of a policy only to cover the specific needs you expect - for many people, this is defined by the amount needed to cover funeral expenses only + possibly their outstanding mortgage balance. If you take the train often, your annual insurance premiums for a full insurance plan may be similar to your 'train only' insurance, while covering you in a wider variety of circumstances. Many people hesitate to think about purchasing not only life insurance not only because of the cost, but also because they do not wish to dwell on their mortality. But facing the subject head on may provide you with both financial and emotional peace of mind.
[And write up a will, while you're at it!]