The wires are for the O2 sensor. The bottom wire (brown to green) is the signal wire. The two white wires in your hand are the heater wires. From the pic it looks like one of them is broken.
Since the O2 sensor is a heated 3 wire, it will still function, but it will take a little longer for the sensor to heat up.
The check engine could be on due to this, but only if the signal wire has a problem. I don't think the check engine will be triggered if the heating element is not working. I would pull the codes to make sure it is not something else causing the check engine light.
Hope this helps.