There is a code stored in the computer. The computer saw a fault and called for the check engine light to come on due to the code. If you have an Autozone near you they will check the code for free. They will tell you what it means and try and sell you the part. Be careful the part is not always what is faulty. There could be a wiring problem or something else so it will need to be diagnosed by a technician.