Bottle gardens function because their sealed environment creates an ecosystem using photosynthesis to recycle nutrients.
Photosynthesis creates oxygen and also puts more moisture in the air. The moisture builds up inside the bottle and ‘rains’ back down on the plant.
The leaves it drops rot at the bottom of the bottle, creating the carbon dioxide also needed for photosynthesis and nutrients which it absorbs through its roots.