You need to understand the difference between entropy transfer and entropy generation or production.
In the two reversible isothermal processes there is a transfer of entropy to the system during the isothermal expansion and a transfer of entropy out of the system of an equal amount during the isothermal compression. Consequently the change in entropy of both the system and surroundings is zero. The processes are reversible because they are carried out very slowly (quasi-statically) transferring heat over an infinitesimal difference in temperature between the system and surroundings.
An example of an irreversible isothermal process is one where the heat transfer occurs over a finite temperature difference producing a temperature gradient at the boundary between the system and surroundings. Entropy is generated at the boundary and passed to the system. So the change in entropy of the system involves two components, the entropy transferred plus the entropy generated due to the irreversible process. In order to return the system to its original state over the cycle (original entropy), the additional entropy generated has to be transferred to the surroundings in the form of additional rejected heat, resulting in less net heat available to perform work.
Hope this helps.