A C of O is needed (at least in my area of the country) any time renovations are made. The way it goes is first you have to get a permit to do the renovation, then you have to have an inspector come and check the work to see that it is up to code, and then the C of O is issued.
It's to protect people from shoddy work...say you turned your garage into a rental apartment and did the electrical work yourself to save money, and did a sub-standard job. It could be the cause of a fire that injures or kills your tenant.
It doesn't mean that there aren't people who still go ahead and do illegal renovations. However, in my area, you also have to have the C of O on record for any renovations before you can sell your house. That's a whole 'nother problem for people who inherit property and want to put it on the market. Suddenly, the basement finished off by your uncle Harry has to be torn out because it's not up to code. If a C of O had been issued originally based on older codes, it would have been grandfathered in. But an inspection of previously unapproved work is held up to the current codes, which in many cases are much stricter.
For example, one of my brother's was purchasing a house that had some wooden steps built to replace some older cement steps. There were more than 3 steps and the current code calls for a railing in that case. When the steps were built, that was not the code, but the owners did not get a permit or C of O when they did the work. Now, in order to sell the house to my brother, they needed a C of O for the work done on the stairs, but they had to bring it up to the current code by adding railings, first.
We had to get a permit and then a C of O when we redid our kitchen. Also when we erected a large storage shed in the backyard. They also make sure people follow any local building ordinances, such as minimum set-backs from the property line, or height restrictions.