because of the free expansion of the ideal gas molecules. The free expansion is an irreversible process and as such, still increases the total entropy, but does not contribute to the surroundings, only to the system.
You can think of it this way. Say I have a compressed piston that I had a large rock on top. If I remove the rock from the top of the piston, it will naturally want to expand until it reaches equilibrium. That expansion is a free expansion and did not change the surrounding entropy, but only the system's entropy. The outside entropy did not change, but the internal entropy of the gas molecules trapped in the piston did.
I hope this helps and if not please continue to ask questions.