Old English be- (unstressed) or bi (stressed) "near, in, by, during, about," from Proto-Germanic *bi "around, about" (cf. Old Saxon and Old Frisian bi "by near," Middle Dutch bie, Dutch bij, German bei "by, at, near," Gothic bi "about"), from *umbi (cognate with second element in PIE *ambhi "around," cf. Sanskrit abhi "toward, to," Greek amphi- "around, about;" see ambi-).
Originally an adverbial particle of place, in which sense it is retained in place names (Whitby, Grimsby, etc.). Elliptical use for "secondary course" (opposed to main; e.g. byway, also cf. by-blow "illegitimate child," 1590s) was in Old English. This also is the sense of the second by in the phrase by the by (1610s). By the way literally means "in passing by" (mid-14c.); used figuratively to introduce a tangential observation by 1540s.
Phrase by and by (early 14c.) originally meant "one by one," modern sense is from 1520s. By and large (1660s) originally was nautical, "sailing to the wind and off it," hence "in one direction then another."
in sporting use, a variant of by (prep). Originally in cricket, "a run scored on a ball that is missed by the wicket-keeper" (1746); later, in other sports, "position of one who is left without a competitor when the rest have drawn pairs" (1883), originally in lawn-tennis.
shortened form of good-bye. Reduplication bye-bye is recorded from 1709, though as a sound used to lull a child to sleep it is attested from 1630s.