Planetary nebulae have nothing to do with the real planets. However, by its circular shape, they resemble the planet. In fact, the planetary nebulas are types of emission nebulae, which consist of the ionized gas ejected at the end of the star’s life.
Something similar will eventually happen to our Sun, but there is still 5 – 7 billion year time. The Sun will turn into a red giant and afterward forms a planetary nebula.