You can battle them after getting a 20 win streak and 48 win streak. In other words, you must win 7 battles in a row twice and the third time at the last battle the brain will battle you instead of normal trainer.
It's in all sections of the Battle Frontier except Battle Hall, which is slightly different since you only have one pokemon. In the Battle Hall you battle the brain after 50 and 170 battles.