Where does the word "Pech" originate, and does it have another meaning?
Also, I'd like to know what's the antonym of "Pechvogel"? "lokvogel"?
"Pech" originates from it's original and still used meaning of pitch, a sticky tar resin that is left over when producing charcoal from wood.
There was a religious believe that there is a lot of "Pech" in hell, thus the connotation with bad luck (see also Grimm's "Frau Holle", "Pechmarie und Goldmarie" and other fairy tales). See also:
"Pech haben" comes from a student's saying in the 18th century to someone who had bad luck. This is a shortening for "Pechvogel". "Pechvogel" on the other hand originates from a haunting method to catch birds by putting pitch on tree branches. (Source: DWDS)
Made a slight mistake and explained "Pechvogel" not "Pech" itself. Delete if necessary.
The German Wikipedia says that the word originated in medieval times and comes from a practice in bird hunting and trapping. Tar was lathered on the branches of a tree, so birds would stick to them when they landed and the bird could be caught easily. Therefore "Pechvogel" became a symbol for someone struck by misfortune. Several other German websites support this explanation of the origin.
Regarding the antonym, "Glückspilz" is correct. "Glücksvogel" can also be used, it is less common though.