In Hermann Hesse's story, why does Siddhartha dream of a woman?
In chapter 5, the chapter named, "Kamala," Siddhartha spends a night in a ferryman's hut where he has a dream. In that dream his childhood friend, Govinda, whom he has just parted with for the very first time of their lives, asks Siddhartha,
"Why have you forsaken me?" As Siddhartha embraces Govinda, he turns into a woman and "out of the female gown poured a spring from a full breast, at which Siddhartha lay and drank, and strong and sweet did the milk from this breast taste. It tasted of woman and man, of sun and forest, of animal and flower, of every fruit, of every desire. It made him drunk and unconscious" (20).
To properly analyze this, it's necessary to pull from the teachings of Carl Jung, the analytic psychologist (and student of Freud). During the writing of Siddhartha, Hesse underwent therapy with a student of Jung and through the relationship eventually met Dr. Jung and subsequently became an avid fan of Jung's philosophies.
According to Jung one aspect of each individual is the "anima" or "animus," determined according to your gender. The anima is the image of the ideal person of the opposite sex. It is your perfect match. This match is called the "animus" in women and is typically unconscious.
Govinda was Siddhartha's lifetime childhood companion. They left their home together to join the samanas (in ch.2) and left there to see Gotama the Buddha. When Siddhartha left Govinda (who stayed behind with the Buddha to learn his teachings), Siddhartha has an awakening or epiphany. He realizes that he's never known himself. He had been running away from himself. This was reinforced by his time as a samana. As a samana he sought to conquer all physical needs and wants, to ignore any physical want or desire for food, sex or pleasure. It was spend in the Hindu stage called Moksha - which is the negation of life, pursuing release from life. Siddhartha sought to dissolve the self, but found that the self was unknown to him. He wasn't able to "dissolve" something he had no knowledge of.
The dream Siddhartha had in the ferryman's hut symbolized Siddartha's physical awakening. In his dream Siddhartha symbolically transformed his childhood companion into a woman, demonstrating his desire to seek out his anima or his (feminine) other half.