Usually you can bring it to a shop and most well-known places will pull the CEL code for free. Or you can invest in a scan tool and do it yourself.
A bad O2 sensor may be to blame I suppose. I’m not sure why the car would shut off, but I guess if you had a bad O2 sensor, then that could be why you felt the jerking. It may be giving false readings to the computer and therefore creating a sudden lean or rich mixture.