Jellies and jams: what is most important to preserve the food?
Jams and jellies most commonly use pectin, not gelatin. But in either case, the purpose is to make it set, i.e. gel up. It's just about texture, not preservation. Without that you'd have a thick liquid, not really much good for spreading on things.

The main ingredient that contributes to safety of canned jam and jelly are is acid: the natural acidity of the fruit you're canning, plus possibly added citric acid or lemon juice. They create an inhospitable environment for whatever survives the canning process. The sugar content does help too, but the pH is the primary concern.

The canning process is also critical. Primarily, it creates a vacuum seal on the jar so that no recontamination happens. Without that, pretty much anything would eventually grow mold. Additionally, pressure canning allows the contents to reach an even higher temperature, killing even more bacteria, allowing for canning of foods without high acid and sugar level like vegetables.

All of this is pretty hard to verify on your own, and the consequences of improperly canned food can be pretty bad (severe food poisoning, possible death), hence the usual recommendation to only use recipes from trusted sources.



If on the other hand you're talking about small batches of jam or jelly that you just keep in the refrigerator without ever canning them, you don't exactly have preserved food. It'll last a while, much longer than raw fruit, but there's a good chance it'll eventually mold.

It's still the acid and sugar that make the difference, though. I'm don't think air flow is really an issue here as you suggest. If you didn't use gelatin or pectin, that thick liquid would still only have air contact on the surface, which is already pretty much the best possible scenario.