I’m just a novice so you’ll want more info/input, but I had a similar situation (see this thread:
Check engine light turned off by itself... what to do?)
In short, I would suggest you find out what code the car is “throwing”. You will need a code reader to do that. A shop can also do this but I have heard some places will do it for free (auto zone?). In my case I was told that it was the exhaust manifold/cat converter which was triggering a sensor and throwing codes. Though the first time this happened it was the engine misfiring and flooding the #1 cylinder (though I doubt that’s your problem because you didn’t mention other issues such as the car shaking).
In short, my guess is it could be any number of things, which the car/computer may be able to tell you.
Hope that helps