Are subs not deducted before tax when going through payroll? Far better paid that way if so. Your manager won’t know if you’re in a union unless there comes a point when you need representation or you go on strike.
Also, if there is an option not to pay into the political fund on the application form I’d tick the box personally.
It's some time since I was in a job where union subscriptions were paid on 'check off' but I'm pretty sure that they are deducted after tax rather than (in effect) getting tax relief. (some professional bodies' subscriptions can have tax relief claimed on them, but not trade unions.)
Some people prefer not to let their employers know, so do it via direct debit. Although as you say, managers will know if there's industrial action, or if an individual gets representation in any individual issue. I'd have thought on the railways, where most grades / workplaces have formal union 'recognition' and where it's quite common for public facing staff to wear a union badge, it's probably not that much of an issue.
Some employers no longer handle 'check off' for unions anyway, and if I remember right, members have to renew authority for it every X amount of time, so it's probably easier for the union to handle it as a direct debit.
Political funds are always optional - although it's usually a tick box to opt out, and some unions may offer the choice to make an alternative voluntary contribution to a benevolent fund or similar, but I think this legally has to be voluntary as well.
Some unions have a political fund linked to the labour party, and paying in to this gives those members a vote in the party's democratic processes, which may or may not suit the individual (I'm aware that some regard the current labour party as not left wing enough, and some regard it as too left wing. I'm not going to get in to that here.) Some unions have a political fund that's not affiliated to any political party, and use it for campaigning on issues rather than a party line. A few unions have a choice of political funds, one (labour party) affiliated and one not.