The resistor will heat up the air (if assume 100% energy convert rate), then the total heat transferred from resistor to air will be given by
$Q = P\cdot t=I^2Rt=IUt$
Then from the first law of the thermodynamics, we know the total inner energy of air $E$ is
$E=Q-W$
here $Q$ is the heat transferred into the system (if heat is transferred from out, then $Q>0$, if the system transfer heat out, then $Q<0$), and the $W$ is the work done by the air (if air do work i.e. air pushes the piston out, then $W>0$, if outside does work to the air, i.e. someone pushes the piston to compress the air, then $W<0$).
So from this, you know the power from the resistor generate heat, and this heat is transferred from resistor to air. If the piston cannot move, then no work will be done, so the increase of inner energy of air is just the heat transferred or generated by the resistor, that is
$\Delta E = Q$
If the piston can move, the increase in energy will result in the increase of air temperature, and therefore, the air pressure will increase and the air will push the piston out. In this process, air do work to the piston. So the inner energy of air will drop, but this work is done by air.