being around bacteria and shit in your gym will put added stress on your immune system so no
but yes sweating can help you sweat out your virus/bacterial infection. it is absolutely true. just make sure you are taking back in electrolytes and water.
It depends on how you feel but I always prefer rest. You wont lose all your muscle by taking a few days off the gym. Recover is often overlooked as to how important it is.