What happens to ESP32 module IO pins when it is connected to ground but not to power?
Unless explicitly documented as allowed, you must never apply an I/O voltage to a chip which is outside the range of its own supply by more than a diode drop.
This is because ordinary inputs have protection diodes to the positive and negative rails which are normally reverse biased or have only a small voltage on them due to minor supply rail differences.
But once the protection diode to the positive rail becomes forward biased, the I/O will end up trying to power the chip and everything sharing its power net!
In this case your resistor probably limits stress, but you get stuck with a pulled down signal and a power net that's at about the internal threshold voltage where the circuit would start operating enough that power draw would increase, preventing it from rising higher when fed from such a high impedance source.
But even if you avoid damage, this situation isn't resulting in the intended operation, and likely consumes supply current in a way you were trying to avoid by powering down the ESP32.  Additionally there are (other) parts where the power on reset circuit will not properly function if the supply rail was in such a lifted-up condition before &quot;real&quot; power was applied.
In your case with the ESP32 you probably want to do one of three things:

Explicitly drive the signal low from its source before de-powering the ESP32

Suspend the ESP32 but do not actually de-power it (though ESP suspend modes are more limited than most)

Use additional circuitry, for example the common MOSFET pass gate type of level shifter includes in its range of operation the situation where the supply for the lower voltage side is entirely absent.  If you're doing a custom board, this basically means adding an SOT-23 FET (BSS138 is probably not idea but widely utilized) and using two pull-up resistors in place of your current divider; if doing a lash-up of existing boards you can buy multi-channel versions of this on postage-stamp sized boards quite inexpensively.


(The exception to all of this is input structures which are rated for moderate overvoltage.  For example, many other 3v3 MCU's have 5v tolerant pins which may not exhibit this behavior.)