Noisy rising and falling edges at the output of a schmitt trigger circuit
Your original schematic has positive feedback through R1. That introduces the hysteresis which is what you want to get a stable one/zero output signal.

In the "swapped inputs" version you get negative feedback. When the output voltage is between GND and Vcc the circuit behaves as a linear amplifier. So you see an amplified version of the input signal at the output.

It is also possible that oscillations occur when the circuit behaves as a linear amplifier. When the comparator is amplifying it has some gain (roughly 22k / (3.3k ||10k) = 8.8). However comparators aren't designed to be stable with feedback, they're designed to give you a lot of gain to get a precise comparison of the input voltages.

The effects (noise) that you do see on the PCB but not in the simulator can be due to a simplified model of the comparator. The model might not contain all the poles which the real chip has. Also noise is usually not part of the type of simulation you did.

If the input signal is lower than a certain value, the output of the comparator gets stuck on the lowest voltage it can do (like 0.5 V above GND)

If the input signal is higher than a certain value, the output of the comparator gets stuck on the highest voltage it can do (like 0.5 V below Vcc).

I think you should restore the original situation as that gives much better behavior.

Indeed the unexpected effects you see are the result of swapping the inputs.