I will assume that what you are referring to is that some, but not all, stars are surrounded by what astronomers call "nebulae". A famous example is the Great Nebula in Orion. A nebula is a cloud of gas that are close enough to a star or collections of stars, that the gas glows. It does this because the star produces lots of ultraviolet light, and when this light strikes the gas, it causes the gas to emit its own light at certain frequencies. This is very much like what happens inside fluorescent lights in your home, or certain kinds of street lights. When atoms of hydrogen, oxygen, nitrogen and other common elements in space are 'excited' by light, what happens is that some of the light is absorbed by the atom, and then re-emitted back into space. No two elements produce the same kind of light, just as no two humans have the same fingerprints. Astronomers can compare the patterns of light ( what we call spectral lines) from distant nebulae, and by comparing them against the patterns of light produced under laboratory conditions by different elements, we can figure out which atoms are present in a distant cloud without even having to go there in person!
There are several different kinds of nebulae. When a star like our sun dies, it ejects a cloud into space called a 'planetary nebula' which sometimes looks like a giant smoke ring several light years across. The above Hubble Space Telescope photo is of the planetary nebula NGC 6751 in Aquila Stars that are 10 times the mass of our sun produce 'super nova remnants' which from earth we see as certain kinds of nebula such as the "Cygnus Loop". For the supernova remnant, the reason you see the gas is not because the central star is stimulating the gas to glow, but because the atoms in the ejected gas are colliding with each other so violently that they excite the gas to glow. When these atoms collide, energy is transferred to the electrons in the atoms causing them to make 'quantum jumps' which eventually result in light ( photons) being emitted.
The Orion Nebula is an example of a cloud of gas surrounding a nursery of new-born, very massive stars, which glows because of the enormous amounts of ultraviolet radiation generated by the young stars within it.