Under Gross Private Domestic Investments, Increase and Decrease in Inventories.
Now we assume at the beginning of the year, inventory level was $100 dollar, during the year the company produced $500, but only sold $400, so by the end of the year, the inventory level went up to $200. $400 inventories have been sold to end users, so they have become final goods and part of GDP of the year. This is easy to understand. On the other hand, another $100 inventories are still in the warehouse, but they were still this year's new production, that's why they are part of GDP.
Now we assume at the beginning of the year, inventory level was $100 dollar, during the year the company produced $500, but sold $550, so by the end of the year, the inventory level went down to $50. $500 inventories have been sold to end users, so they have become final goods and part of GDP of the year. On the other hand, we have used another $50 inventories from last year, they also have become the final goods to the end users. However, we counted this $50 as part of GDP last year. That is why we have to substract this $50 from this year GDP to avoid double counting.