Best guess as to the reason that both ammonia and baking soda relieve
bee and other insect stings is that both are "bases" and counter the
acids in the venom. There are lots of different acids in many insect
stings (including non-insects like portugese man-of-war, a salt water
creature) which when treated with a base, relieves the sting. Acid+ Base
= a salt and water, so the acid is nutralized, at least what the base
(ammonia) can get to.