VOLATILE compounds in comets are the most pristine materials surviving from the time of formation of the Solar System, and thus potentially provide information about conditions that prevailed in the primitive solar nebula1-3. Moreover, comets may have supplied a substantial fraction of the volatiles on the terrestrial planets, perhaps including organic compounds that played a role in the origin of life on Earth4-6. Here we report the detection of hydrogen isocyanide (HNC) in comet Hyakutake. The abundance of HNC relative to hydrogen cyanide (HCN) is very similar to that observed in quiescent interstellar molecular clouds, and quite different from the equilibrium ratio expected in the outermost solar nebula, where comets are thought to form. Such a departure from equilibrium has long been considered a hallmark of gas-phase chemical processing in the interstellar medium7, suggesting that interstellar gases have been incorporated into the comet's nucleus, perhaps as ices frozen onto interstellar grains. If this interpretation is correct, our results should provide constraints on the temperature of the solar nebula, and the subsequent chemical processes that occurred in the region where comets formed.