According to no canonical sources, "NCC" is in reference to the contract required to build a starship and to easily be able to identify parts from ships when salvaged. It is suggested that "NCC" is short for "Naval Construction Contract", this number is imprinted into every part laid into the ship, similar to the imprinting of Naval hull numbers into parts and systems on modern ships, (i.e. CVN-65 is stamped into every part on the USS Enterprise the US aircraft carrier). The idea about an "NX" (Naval eXperimental) ship, when fully comissioned, the ship goes through refit, and becomes an "NCC" ship.
In the original series of Star Trek, the only registries seen were for ships either unseen, or seen to be of the same class as the Enterprise. The speculation by fans as the time was that 'NCC' was a hull code like the United States Navy's codes, which designates the basic types of vessel, and is then followed by a ship identifier number. 'NCC' was explained as 'cruiser' and 'NDD' suggested as a 'destroyer'.
This was blown out of the water by Star Trek II: The Wrath of Khan, which featured the USS Reliant, a clearly inferior ship to the Enterprise, and still registered under NCC.
Later films and series showed that nearly all Starfleet ships used 'NCC', but a few, experimental ones used 'NX' (seen on the Excelsior, and Defiant).
This was confirmed in Enterprise with the registry 'NX-01' for the experimental ship of the title, but this was explained in a way which is at odds with chronologically later usage - NX is being used as a class name, and 'NX-01' means 'the first ship of the NX class'. It remains to be seen how or if these systems can be reconciled.
Again to this point, how was it to be known that certain vessels were given identifier numbers that were preceded by NAR CLASS VESSEL, such as the USS Raven from ST: VOY, and the following classifications: NCC- NCV TIME VESSEL NCC- NDT CLASS VESSEL NCC- NFT CLASS VESSEL NCC- NGL CLASS VESSEL NCC- NSP CLASS VESSEL, including the most important of scientific vessels, the Oberth class.