When you disconnect the battery, you are opening a circuit, so that isn't surprising that it stalls. As far as the idle issue with the A/C, that could be a couple things. The electric throttle body will adjust the throttle blade for idle control. If that is not working, the throttle body itself needs replaced. It isn't serviceable. However, lets start with something other that can cause an idle issue.
Once of the most common causes of a stall at idle is an engine vacuum leak. Take a look through this link and see if it is something you are comfortable doing:
That is where I would suggest starting. If the check engine light is staying on when the engine is running, we need to have the computer scanned for trouble codes. That can help point us in the right direction.
Here is a quick video showing how it's done:
I realize most people don't own a scan tool, but most parts stores will do it free of charge. If the light is staying on, have it done and let me know what codes are retrieved.
Let me know,
Saturday, August 29th, 2020 AT 1:51 PM