This quote is from the scriptures, although it’s a little truncated. Ideally omissions from quotes should be marked by ellipses, but that hasn’t happened in this case:
“If you cannot find a good companion to walk with, walk alone, like an elephant roaming the jungle. It is better to be alone than to be with those who will hinder your progress.”
As soon as I saw it I was reminded of a verse from the Dhammapada, and my instincts turned out to be right.
However, it’s not exactly a quote, but an adaptation of two Dhammapada verses:
329. If for company you cannot find a wise and prudent friend who leads a good life, then, like a king who leaves behind a conquered kingdom, or like a lone elephant in the elephant forest, you should go your way alone.
330. Better it is to live alone; there is no fellowship with a fool. Live alone and do no evil; be carefree like an elephant in the elephant forest.
So, this isn’t quite fake, but is kind of in a gray area, being more of an interpretive paraphrase than an actual quotation.
I’m afraid I have no idea of its origins, since it’s not in any books on Google Books, as fas as I’ve found, although the last part of the quote is very similar to a piece of advice given in Instant Karma, by Barbara Ann Kipfer (2003): “Choose to be alone rather than be with those who will hinder your progress.”
But you may be surprised at how common such sentiments, and even precise turns of phrase are. For example, at the tender age of 14, George Washington apparently compiled a list of 110 rules for civility. Rule number 56 was, “Associate yourself with men of good quality if you esteem your own reputation; for ’tis better to be alone than in bad company.”