Avalokiteshvara is the same figure in India and in China, and is male in one and female in the other, and the change is documented well enough to be traced.
In the Indian sources the bodhisattva of compassion is male. The Lotus Sutra devotes a chapter to him, listing the forms he takes to reach beings, and the Karandavyuha Sutra, of perhaps the fourth or fifth century, makes him a cosmic figure from whose body the world is generated and gives the six-syllable mantra its setting. The name is usually parsed as the lord who looks down, or the lord who observes the cries of the world.
In China he became Guanyin, in Japan Kannon, in Korea Gwaneum, and by the Ming period the standard depiction is unambiguously female, white-robed, sometimes holding a child, and functioning in popular religion as a goddess of mercy and of childbirth. The transition can be followed in the material record: sculpture and painting from the Tang are male or ambiguous, and the female form becomes dominant from roughly the tenth to twelfth centuries.
Chun-fang Yu's study of this transformation is the standard account and argues that no single cause explains it. Contributing factors include the Lotus Sutra's own list of forms, which includes female ones; the absorption of indigenous Chinese goddesses; and the emergence of the Miao-shan legend, in which a princess refuses marriage, is killed by her father, and returns to save him. Glen Dudbridge traced that legend to a twelfth-century inscription.
The Tibetan reception went the other way, keeping the male form and identifying the Dalai Lamas as his emanation.