Adding heat to a system doesn't equal the work done by gas?

So, I answered a physics question for a class that goes as follows:

A gas in a cylinder is kept at a constant pressure of $250000\: \mathrm{Pa}$ while $300\: \mathrm{kJ}$ of heat are added to it, causing the has to expand from $0.9\: \mathrm{m^3}$ to $1.5\: \mathrm{m^3}$. What is the work done by gas?

I knew the answer was to use $W = P \Delta V$, which worked, giving an answer of $2.1 \times 10^5\: \mathrm{J}$.

However, conceptually I am having a hard time understanding why the $300\: \mathrm{kJ}$ of heat being added to the system doesn't just equal the amount of work done. Aren't why just converting the heat energy into work, with all forces conserved?

Because there's another term in the equation called the first law of thermodynamics, namely $dU$, the change of the internal energy! $$dU = \delta Q - \delta W$$ When one heats an object, the most obvious consequence is that this something gets warmer. It doesn't have to expand to do any work, it just heats up. In a general case, the heat $\delta Q$ is divided to the work done $\delta W$ and the change of the internal energy – dependent largely on temperature – $dU$.