"train (an infant or animal) to forego suckling," c. 1200, from Old English wenian "to accustom, habituate," from Proto-Germanic *wanjan (source also of Old Norse venja, Dutch wennen, Old High German giwennan, German gewöhnen "to accustom"), from PIE *won-eyo-, causative form of root *wen- (1) "to desire, strive for."
The sense of "accustom a child to not suckling from the breast" in Old English generally was expressed by gewenian or awenian, which has a sense of "unaccustom" (compare German abgewöhnen, entwöhnen "to wean," literally "to unaccustom"). The modern word might be one of these with the prefix worn off, or it might be wenian in a specialized sense of "accustom to a new diet." Figurative extension to any pursuit or habit is from 1520s.