Your car is equipped with an on-board-diagnostics (OBD) system. The OBD checks for problems when the engine is running. If it finds one, and depending on the nature of the problem, it will store a code in a memory and it will turn on the Check Engine light. The code that is stored in memory will identify where in the area of the engine the problem is occurring. By reading the code, mechanics will have a better idea of what the fault is and where.
These newer cars are complex, and use a lot of electronics and computer processors to run. Having the OBD is not only helpful, but necessary to enable proper analysis. By disconnecting the battery, you may have turned off the check engine light, but you also eliminated any record of the fault that had been detected. It would be difficult for anyone here, or at a garage, to suggest what's going on to any degree of accuracy, without having the code.
Next time, don't erase the code by removing the battery connection. Take the car to a dealer, or even an auto parts store that has a service department. (Many of the latter will connect a code reader to the car and let you know what the code is without charge.) The code is in the form of a letter, such as "P", followed by four numbers, for example, P0301. Get the code, or codes, and then look it up on the Internet, or report back here.
(Incidentally, you had a thread on this previously: 2001 Outback H6 idle surges