Old English gandra "male goose," from Proto-Germanic *gan(d)ron (source also of Dutch gander, Middle Low German ganre), from PIE *ghans- "goose" (see goose (n.)). OED suggests perhaps it was originally the name of some other water-bird and cites Lithuanian gandras "stork." Sometimes used 19c. in reference to single men or male-only gatherings (compare stag). Meaning "a long look" is 1912, from gander (v.).
"take a long look," slang, 1886, from gander (n.) on the notion of craning one's neck like a goose; earlier it meant "to wander foolishly" (1680s). Related: Gandered; gandering.