Today’s vehicles have sophisticated computers that control the vehicle operation. The computers get input from numerous sensors located on the vehicle. When a sensor receives an abnormal signal that would affect the performance of the vehicle the check engine light comes on. It only comes on if there is a problem. Don’t ignore the light even if the vehicle “seems” to run fine.
If the light comes on steady have it checked. If it comes on and is flashing, get it checked right away as potential damage to a major component will occur. The engine management systems are complicated and should be left to a professional to accurately diagnose why the light is on.
Basic code readers will only identify what system is affected and only points you to where the problem is. A common misconception is they tell you exactly what the problem is. If a vehicle is driven long distances with the light on there may be multiple problems that also develop without you knowing. Sometimes the early fix is cheaper than waiting.