Three generation of stars
The history of the Elephant's Trunk Nebula started about 15 million years ago when the first generation of stars were born a few thousand light-years from Earth in the direction of Cepheus. Some of these stars were born with sufficiently high mass to end their lives in supernova explosions a few million years after their birth. The cumulated stellar wind of the first generation stars and the shockwave of the supernova explosions created an enormous bubble in the interstellar medium. The diameter of this bubble is about 400 light-years.
As the bubble was expanding, molecular clouds at its edge became denser and denser, about 7 million years ago the density and pressure became high enough to ignite the formation of the second generation of stars. The giant blue stars of the Cepheus OB2 association including the star HD 206267 and some other hot blue stars of the IC 1396 complex were born in this process. HD 206267, the brightest star in the upper left corner of the picture, is about 3-4 million years old, its high energy ultraviolet radiation ionizes the remains of the cloud which it was formed of, making the cloud glow in red. A small part of this cloud is filling the picture providing the reddish background.
The heavy stellar wind of HD 206267 started to expand and erode the nebula. During this process, some regions of the cloud formed globules, which are compact, dense regions of gas and dust. Several of such globules can be observed in front of the red nebula, however only one could fit in the field of view of this photo. The elephant's trunk is actually such a dense cloud, its length is more than 20 light-years. Its direction is radial, pointing from HD 206267 outwards to the edge of the nebula. This is because the star's intense stellar wind is blowing it away. If there was no other star nearby, the globule would appear straight. Fortunately other young stars in the complex are also putting some pressure on the dark cloud from sideways, sculpturing it curvy. An additional effect of the pressure created by HD 206267 and other stars is triggering star formation inside the dark cloud. There are about 250 very young stars in the globule less than a hundred-thousand years old. They are still being hidden inside the dense cloud, however they are already visible in infrared images. These stars are the members of the third star-generation in the area.
The "pineapple" in the trunk
There is a spherical cavity at the base of IC 1396A, which is created by two stars. Their strong stellar wind swept most of the remaining dust and gases around them away, creating the spherical cavity. Their light is illuminating the surface of the hole they created, making its inner wall shine in yellow. In the picture this yellow patch looks like a pineapple in the elephant's trunk.
In visible wavelengths one of the stars creating the cavity seems to be fainter than the other, however in infrared they have similar brightness. The difference in visual brightness might be caused by a dense protoplanetary disk around the star, absorbing some of the light emitted by the star. The absorbed light heats the disk, which starts to radiate in infrared.