The infamous Check Engine Light:
.
Modern engines are computer controled to allow them to acheive great realibility and fuel economy. The computer utilizes actuators to control the engine and utilized sensors to determine the state of the engine. Once all the sensors are warmed up, the computer enters a closed-loop state. This means it is using the input of the sensors to determine how to best control the engine. This is when the car is running as efficiently as possible.
As the computer is receiving input from its sensors, it is ensuring these inputs are within valid ranges. Whenever it encounters unexpected values, it stores this information in trip memory. If the same condition happens again in another trip, cold-to-warm up, the computer will turn on the Check Engine Light.
When the Check Engine Light is on, to retrieve the error code, a code reader is utilized. The following image is what one looks like: 
On newer cars, one of the most popular reasons the Check Light comes on is due to a poorly sealed gas cap. Yup. The gas cap. So, whenever someone asks me about a check engine light, here's what I tell them:
- Get a shop rag
- Remove gas cap
- Clean gasket on gas cap with rag
- Wipe down filler pipe with rag
- Reinstall gas cap ensuring you screen until you hear clicks
- If this is the issue, the check engine light will turn off after a couple trips, cold-to-warm cycle.
If not, you'll need to utilize an engine code reader to pull the codes. After retrieving your codes, enter in your make and codel and the codes into Google. Many times, other people have solved your issue.
I suggest this even if you're not a motor-head. I feel this gives you the upper hand when you go to the dealer by allowing you to determine if the dealer is telling you the truth. The codes they pull should match what you have retrieved. The research that you do via your favorite search engine will determine if the work they suggest to fix the issue is correct.