Arduino and voltage divider plus N-MOSFET
The keyfob switch is usually connected from one terminal to its positive supply and from the other terminal to the input of its controller IC. If you connect the latter to the ground you are inhibiting the switch and maybe short circuiting the keyfob battery if you press the switch.
You can replace your mosfet by an optocoupler. From esp32 side you connect the output to the photodiode of the optocoupler through a resistor and the transistor of the optocoupler to the keyfob switch.