Body odor is a combination of sweat and bacteria. Sweat is actually odorless; it is bacteria that live off perspiration on our body that create the bad smell.
Humans generate apocrine and eccrine sweat. Eccrine sweat is used to lower our temperature, like when we exercise or when it's really hot. It is produced uniformly all over the body and does not smell.
Apocrine is a special type of exudation that is produced in places like the armpits, groin, hands, and feet. It is the latter that causes all the trouble, but like eccrine sweat, it also doesn't smell. Apocrine perspiration simply contains fat and protein.
So how does apocrine sweat tend to make us stinky?
Some bacteria on our body feed off apocrine sweat. Once they consume the sweat, they do what any living creature on earth does: they defecate Yup, you guessed it; B.O. is the smell of bacteria excrement!
Actually, bacteria don't really defecate like we do — they break down chemical bonds — but they do consume our perspiration, and that makes us smell.