The phrase “to look a gift horse in the mouth” is as old as the fourth century A.D. and once had a literal meaning.
Up to a certain number of years, a horse’s age can be determined by examining its teeth.
To perform such an examination on a horse you’ve been given is looking a gift horse in the mouth.