"By the bye" comes from an old sailing term. "Sailing by the bye" means sailing close-hauled (ie close to the wind direction). If you weren't sailing on the bye, you would be sailing large, sails out and away from the wind's direction. To refer to all forms of sailing one would say "bye and large".
What does by the bye mean?
Incidentally, in passing, as in By the bye, my wife is coming too, or Exactly where do you live, by the by? The bye or second by in this term originally meant “a side path,” whence the current sense of “off the track” or “of secondary importance.” [Early 1500s] Also see by the way.
What does it mean to say by the by?
Definition: Incidentally; a statement made before comment made in passing. By the by is a phrase that is said before making a comment that is unrelated to the previous topic of conversation. It may also be used when there is a long silence and the speaker wants to ask a new question.