It's not so much about food, but just the fact that a tree can only store as much carbon as it can fit inside its trunk and branches. In a rain forest, there is really no new growth happening--trees are dying (releasing CO2) and new trees are beginning to grow (which suck up and store CO2) so the net effect is roughly 0. In an ideal world however, some of the dead trees become buried (and in millions of years become coal), but currently deforestation is more than outweighing this natural sequestration effect.
And by the way, CO2 does not trap heat, it converts radiation into heat. The CO2 and other GHG's act much more like little furnaces than a ceiling of a greenhouse ;)