Check engine light comes on when turbo kicks in, loses power and engine runs rough. Turn off engine and restart, it then runs smooth again.
When the check engine light comes on the computer stores a code. Have the code scanned to find out what it is and you’ll be closer to finding out what’s wrong.
What engine/x5 is it?