gaggin at fish

We went to the beach today(it was 80!)
It smelled of fish, but not too strongly.
Last summer one day it was really pungent and I started gagging.
Why does the body gag when presented with a bad smell?
What would Desmond Morri speculate about this?