In Encounter at Farpoint, Q is clearly unknown to the crew of the Enterprise. Three years later, he's well known enough by Starfleet to deserve his own briefings to command personnel. (Sisko mentioned as much in the DS9 episode "Q-Less", and I'm using the dates listed on Memory Alpha.) He never appeared in an episode of Enterprise or the original Star Trek series, so I feel that we can be fairly confident that when he put Picard on trial, that was Starfleet's first encounter with Q and the Continuum.
Surely there are thousands (millions?) of races in the universe with millions (billions?) of starships. Did Q choose at random? Was there something about humanity or that ship or that captain in particular that intrigued him?
Why Picard? Why the Enterprise? Why that moment? Why humanity?
The Squire of Gothos
.