paul, someone in the wetsuit industry clued me in some years ago. All "foams" are made one of two ways. Either they inject compressed gas (nitrogen) under pressure, and then release the pressure to allow the foam to fizz up in a mold, or they use "pancake batter" which fizzes up as it is heated in a mold.
The batter solidifies and cures to become the "foamed" rubber, either way. But using compressed nitrogen, which is chemically inert, is way way more expensive than using "pancake batter" which will bubble up from internal chemical reactions, literally just like baking a soda bread. Odds are the odors are from the various chemicals given off during the curing, and they are simply trapped by the plastic wrapper.
Some of the companies make a point about the non-toxicity of their foams, because you never really know what it is you are inhaling, up close, for eight hours every night, while a new mattress is outgassing. Another good reason to let it air out until you really can't smell anything from it.
The 3M #77 won't melt upholstery foams, it is designed for them. That's one of the materials normally used to assemble layers of foam mattresses. I'm sure there are others that are water-based and don't use petroleum solvents these days. Latex-based "cove base molding adhesive" from the hardware store also can work very well, it is a white paste designed to bond rubber/vinyl moldings to wall bases, but then you'll have to "butter" both pieces of foam in order to apply it. Water based, no solvent worries, but I'll keep using the 3M myself.