“Don’t look a gift horse in the mouth” is a polite way of saying don’t be a jerk if you get a gift with which you’re not exactly thrilled. The expression stems from the ability to tell a horse’s age by looking at its teeth. As horses age, their gums recede. The older they are, the longer their teeth look. So if someone gave you a horse as a gift (and boy if I had a dollar for every time that’s happened to me) it was considered rude to check out Nellie’s pearly whites to see exactly how good a gift the old girl was. So if this happens to you, just take the damn horse, say thank you, and if you don’t like it, do what everybody else does…re-gift it.
As a side note, this expression is related to describing someone as old by saying they’re “long in the tooth.”