Where I live, cars need certification/a license to be operated. The manufacturer does that for you, so you can obtain the required document quite easily for your car.
Aftermarket parts are regulated - you can't install what you want, it needs to be certified for your specific make and model (and motor variant, etc.) - otherwise your car is not legal anymore.
This applies to chip tuning as well. Since you're modifying a certified part, it looses the certification - obviously.
What new cars are allowed to emit, is strictly regulated.
Further, since this very month, we have a carbon-based tax on new cars (based upon the aforementioned certification from the manufacturer). Thus if the emissions of car are changed, you're basically evading taxes as well.
Where I live, chip tuning is almost only done to get a few HP on the cheap. And it is unfortunately very popular and nobody really cares.
Edit: You can seek in individual certification for some modifications, added to your documentation, but a tampered with ECU is not one of them I think.