A check engine light, or often MIL (malfunction indicator light) Is just that. The engine controls see something outside of parameters. This can be out of normal range or a input actually missing amongst other things. So the problem condition ceased to exist, light goes off. The trouble code will likely be stored as a “history” code and can be retrieved with a scan tool. Hope it’s an easy one for you!
Correct. Something that was plugged into it is broke off. Gently get up under it, preferably something plastic and ease it out of there.