The simplest explanation for how the Hansens knew stories about the Borg is that the El-Aurian refugees told about them when they arrived in Federation space in 2293.
And if you look at the dialogue in "Q Who?", there's nothing in it strictly saying that the Federation had no prior knowledge of the Borg. It could be that the Enterprise computer had records of the rumors and tales, but Picard preferred to use Guinan as his source of information about them because she was an eyewitness.
And if you look at the dialogue in "Q Who?", there's nothing in it strictly saying that the Federation had no prior knowledge of the Borg. It could be that the Enterprise computer had records of the rumors and tales, but Picard preferred to use Guinan as his source of information about them because she was an eyewitness.