The key factor is that baking soda is amphoteric. This means that it can react both with strong acids and with strong bases which are typically smelly compounds (sour milk, rotten fish, fatty acids in sweat).
The explanation on the third page of this document gives a nice summary:
The chemical explanation of why bicarbonate of soda should act as a deodorant is of interest. Sweat (3) has an acid reaction, pHpH of 5.2–6.755.2–6.75 which is due to the fatty acids or acid phosphates of sodium and potassium which it contains. It also contains NaClNaCl, KClKCl, alkaline salts, organic acids and urea. Minute amounts of unstable fats and oils are secreted in sweat and hydrolysed to their corresponding fatty acids and glycerin. Free fatty acids may be secreted. Many of these acids are volatile and have a characteristic disagreeable odor. These include butyric acid, formic acid, caproic acid and valerie acid. The following are among the possible explanations of the manner in which sodium bicarbonate acts as a deodorant in the axilla.
It forms a sodium salt with butyric, caproic and valerie acids. These sodium salts are comparatively mild in odor in comparison to the volatile "rancid-smelling" fatty acids.
By changing the pHpH of the axillae, the bacteria which decompose the fats are unable to act. However, as a result of this the staphylococcic flora which prefer higher alkalinity might thrive and axillary furunculosis might result.
To give an example. The reaction of baking soda with butyric acid looks like this:
while butyric acid is extremely smelly (an intense vomit smell), the salt hardly smells at all.