Stagnant water will have reduced oxygen levels. This encourages the growth of anaerobic bacteria. The smell will be the byproduct of the breakdown of organic matter by these bacteria. It will most likely be due to gases such as hydrogen sulphide and nitrogen dioxide.