There are a lot of mechanical things that could happen but do NOT worry about that until you have the car scanned by your mechanic because the odds are extremely high that it is a very simple issue with spark (coil pack or plug) or fuel injection (injector not spraying or not spraying the correct pattern).
The 3.6L had become highly reliable by the time the ATS was introduced, the original generation 3.6L I had in my 2008 CTS is known for timing chain guide wear which was made far worse by GM trying to match BMW's idiotic extreme mileage between oil change interval when they introduced their DI engine. I had a fairly early production 3.6L direct injection but it got its first oil change at 1,000 miles and thereafter was changed at the 60 and 20% OLM indicated intervals at which point I would reset it. If you followed the original OLM calibration, it would allow over 25K between changes under normal conditions which was ridiculous and that OLM set of constants was changed through a recall with new calibration by GM after the engines started eating timing chains early in life. Mine was still fine at 90K when I traded it in for my ATS.
The 3.6L has been one of my favorite GM engines, along with the highly reliable "3800" and the classic 350 V8. Anything can break and break expensively but your odds are very favorable with GM's better engineering efforts and the 3.6L falls in that school. I ordered the current generation 3.6L when I bought a 2021 Camaro after my daughter started driving the ATS. I would have ordered the CT-4 replacement for the ATS IF they had a powertrain choice I liked, if the 3.6 had still been available I would be driving a CT-4 instead.
Shortly after my generation of Corvette was released (I have a 2016 C7 Z06), a bunch of owners freaked out when their nearly brand new vehicles displayed the same symptoms as your car. The assembler wasn't always pushing the spark plug wire caps firmly onto the plugs and many cars with under 1,000 miles were suddenly displaying a flashing CEL for misfire along with shaking and TCS and Stabilitrak systems disabled.
Rodger