Your knowledge regarding the polarity is wrong. The light is allowed to fall on the anode and its being poisitive allows the electrons to eject out if sufficient enrgy is provided and the ejected electron moves towards the cathode with some kinetic energy. Generally the electrons are negative and it should be attracted towards anode and it should not come out of the metal surface but if the frequency or the energy of the photons are that much high i.e,higher than the work fuction or threshold frequency then the electrons get ejected and travels towards the cathode which is negative. In that case also the cathode tries to oppose the elcetrons from coming towards it as negative repels negative but the energy of the photoelectrons are that much high to oppose the force of repulsion. But when the negative voltage of the cathode is increased gradually then the opposing force increases and when the potential of the cathode is increased as much that it is greater than the kinetic energy then the electron stops at a particular negative voltage of the cathode and that voltage or potential is called the stopping potential.