These giant stars are called Wolf-Rayet stars and burn the hottest of any stars in our universe. This results in a stellar wind that envelops the star in the elements it's producing, which eventually forms a bubble around the star. Dust and gas become trapped inside the shell of this bubble, which is a great place for new stars to form.
The current prevailing hypothesis about the formation of our solar system is that it formed in the neighborhood of a supernova. However, this theory fails to explain the abundance of the isotope aluminum-26 in our early solar system, nor does it address our lack of the isotope iron-60. The proportions of these two elements in our early solar system, as compared to the rest of the galaxy, is something of a cosmic mystery. But the Wolf-Rayet theory may have provided a solution: While supernovae release both isotopes in some quantity, Wolf-Rayet stars produce aluminum-26, but not iron-60.
The giant star may be long gone (whether through a supernova explosion or direct collapse into a black hole), but before it died, the shell would have partially collapsed. The result was the birth of our solar system. While nothing is really for certain when it comes to what we know about space, it's certainly an interesting theory that deserves further study.