
Halley's comet was made when a nebula was formed by a supernova. That gas and dust from the nebula collects, and later it freezes in cold outer system. That gas forms into icy objects and those objects accrete(objects come together). Those icy objects formed Halley's comet making it a rocky and an icy object. Later the sun's gravity pulls Halley's comet to orbit it. While coming to the inner layer of the solar system, some gases of the comet warm up and that is why scientists found hot and cold gases on Halley's comet.