It could be many things.
You can check old posts about check engine light here on this forum. There are quite afew informative ones.
As far as I know, it could be:
1) bad o2 sensor (s)
2)exhaust pipe leaking
3) engine problem ( such as oil gel..)
The light was probably on before it was sold to you. The prevous owner might have unpluged the battery to turn the light off. It will not pass inspection if you won't get it fixed. You should go after the seller...