The gas for the most part has simply leaked in from the atmosphere, between the cells, through stomata and lenticels etc. To a good approximation it is simply air. There are a few complications of course; it is pretty moist as air goes, and it contains some products of metabolism.
Also, some gases would at various times be absorbed, and at other times augmented. For example, while the fruit is young and green and actively photosynthesising, it would absorb any CO2 that either came in with the air, or got produced metabolically. As the fruit ripens and the chlorophyll gets broken down, photosynthesis would stop, increasing the CO2 content to above atmospheric levels.