In Supergirl S05E10, the scene where all the brainiacs are gathered in the DEO, we see that one brainiac comes shouting "Do not let him open the bottle" and then he disappears. It is later revealed that the brainiac that bottled his world killed him because he knew about the bottle and it's secret. So how did that brainiac know about this when all the others didn't.
The real answer is we don't know.
At max, we can do some assumption how good Brainiac 5 know about what evil Brainiac 5 was planning:
In his universe he is familiar with bottles and when he saw him with one he added one plus one
He spied or witnessed him with his fishy deeds
But neither in episode nor after they made it clear, so it's just a plot device that he knows it and there to send the warning “beware of the bottle.”