You can buy the check engine computer and the book comes with it. I know, I bought one. When your check engine light comes on, you plug it in and check the engine and it will give you the code and you look in the book for that code and it gives you the answer.
The check engine light comes on and stays on when a problem is detected by the self diagnosis system of your vehicle. Generally, a check engine light is lit when there is a problem in the emissions or something that is affecting the effectiveness of the emissions.