Although Bernard Shaw is associated in the minds of many with longevity, old age, and arcane wisdom, the above words come from one of his public broadcasts, entitled 'School'. The full text of the speech, broadcast in 1937, can be read via The Listener Historical Archive (if you have a subscription, that is. You can apply for a free trial if you live in Canada or the USA, though).
There is also a snippet view available of Leonard
Conolly's Bernard Shaw and the BBC (p. 197) where you
can read the transcript of the speech. The broader context of the quotation reads as follows:
"Some of your schoolfellows may surprise you by getting
hanged. Others, of whom you may have the lowest opinion, will turn out to be
geniuses, and become some of the great men of your time. Therefore always be
nice to young people. Some little beast who is no good at games and whose head
you may possibly have clouted for indulging a sarcastic wit and a sharp tongue
at your expense may grow into a tremendous swell, like Rudyard Kipling. You
never can tell."
Passages like these have inspired some people to create
visual and metaphorical representations of it, like in the following video I've
found, with Shaw's original audio: