Transient voltage noise in 240 V AC mains detection circuit MSP430FR2311 gets RESET
Your circuit, as drawn, can't put more than 3.3V or less than zero volts on the uC pin. Yet, you're seeing that, so something else must be happening.  It seems likely that whatever 230VAC load you're switching is injecting noise into the power supply for the uC. Try putting your scope on the uC power supply, as close to it as you can get, and see what's there.  If you do see a transient there, that's the first thing to fix.