How can I get shocks while charging my phone in the train?
It can be more than just capacitive coupling between the windings of the transformer. Some designs couple high frequency output noise (due to the switching action of the controller) back to the nearest thing to ground that is available and that generally means the high voltage DC supply line after the AC power rectifier. Coupling is done with a capacitor like this: -



So, it trades better EMC performance for a slight tingle when you touch the DC output wires or you touch the metal parts of the device it is charging.