Your plant may have root rot which is causing it to smell. Try transplanting it into a new container with fresh soil and throw the old potting soil away.
If this type of foul smell is coming from your plants in your garden then you have one problem. You are using the wrong type of fertilizer on your plants.