Thermodynamics : Work Done by a Gas
Assuming an adiabatic wall between gas and surroundings then the expansion of the gas will do work on the surroundings.  What is that work?  It is the pdV work using the external pressure acting against the piston from the surroundings.   You are asking why not use the pressure of the gas.  You could, but only if the process was reversible.  That is, the gas is at equilibrium throughout the expansion process.  

But what if the gas is not at equilibrium throughout the expansion?   The pressure may not be uniform inside the gas throughout the expansion.  If the gas is expanding irreversibly then the pressure just behind the piston will be lower than the other parts of the gas.   It's easier to calculate the work on the surroundings since you know the external pressure is uniformly applied.