She is the daughter of Paul Atreides and his Fremen concubine Chani, and the twin sister to Leto II Atreides. Like her aunt Alia and her brother Leto, Ghanima is pre-born; Chani had consumed so much melange during her pregnancy that Leto and Ghanima had awakened to full, adult consciousness before birth, receiving the genetic memories of both their male and female ancestors.
In the Bene Gesserit ritual known as the spice agony, an acolyte ingests an "illuminating poison" called the Water of Life which, if the initiate survives the ordeal, unlocks these Other Memories. These ego-personalities reside in the background of consciousness, but may be accessed to provide unique knowledge and insight. However, the memories unleashed in this ritual are always of female ancestors; access to the male line is unique to the pre-born, and theoretically to a specially-bred male known as the Kwisatz Haderach.
The equally unique danger is that, because an unborn child has not yet developed a strong personal identity, the in utero exposure to Other Memory makes that individual highly susceptible to becoming possessed by the personality of one of their ancestors. Called an Abomination by the Bene Gesserit, a child born this way is always killed whenever possible. Unlike Alia, Ghanima never succumbs to Abomination; her mind is ultimately guarded from possession by the memories of her mother Chani.
Ghanima has a very close relationship with Leto; they work together to create the Golden Path, a plan to avoid humanity's almost inevitable future destruction. She supplies her fertile creativity to the details of the plan, and even ensures its success by performing a ritual to make herself believe that Leto is killed by Laza tigers, when in reality Leto is searching the desert for Jacurutu. Her memories are restored when Leto speaks to her the key words, "Secher Nbiw" i.e. "The Golden Path" translated into Chakobsa, an ancient language.
Alia tries to use Ghanima as bait for House Corrino by promising her hand in marriage to the Corrino heir, Farad'n, which Ghanima initially resists. She relents after swearing to kill him on their wedding night.
Upon Leto's ascension to the Lion Throne, he weds Ghanima in a purely symbolic marriage. Ghanima agrees to take Farad'n as her mate, and Leto appoints Farad'n to the post of Royal Scribe. As Leto's joining with the sandworm effectively renders him sterile, Ghanima and Farad'n would thus ensure the continuation of the Atreides line.