Microcontroller overheating when sensor is plugged in
One problem is that your microcontroller pin is configured as an open-drain output, instead of a high-impedance input. I think the confusion is that the sensor does have an open-drain output, but this is not the setting to use for your input pin.



In an open-drain configuration, if you set your pin high, the voltage will float up to the voltage on the other side of the pullup resistor. In your case, you are using an internal pullup, so this would be 3.3V.

But, if the pin is low, it will create a short from the pin to ground. Any externally-applied voltage will then burn out your IC (if it isn't current-limited).  However, if your only connection to a voltage is via the internal pullup resistor, the current should be well within limits.

Although, as Spehro notes, I'm unsure if the pullup will work when the pin is set to an AF mode.