The polarities of the electrodes is imposed by the power supply in electrolysis.
That is, the power supply forcefully withdraws electrons from the ANODE, therefore it is 'positively charged' as there is a loss of electrons and an accumulation of cations around it.
For the cathode, electrons are forced onto it, giving it a negative charge as it is being bombarded with electrons.
In galvanic, it is the reverse because it is the chemical reaction that determines the polarity of the electrode. Oxidation means loss of electrons, i.e., anode is negative here. Reduction means gain of electrons, i.e. the cathode consumes the electrons so is positively charged.
The electrolyte is there to provide a source of ions to migrate to the anode/cathode to prevent build up of charge around the electrodes.
Hope that helps
