The source of cob in the compound cobweb is coppe, a Middle English word for "spider." That word derives from the Old English name ātorcoppe. Ātor meant "poison" and coppe was a derivative of either cop, meaning "top" or "head," or copp, "cup" or "vessel." In either case, ātorcoppe was formed in reference to the supposedly venomous head of the spider.
In the 14th and 15th centuries, cobweb was used in the form coppeweb. The change from p to b evolved over the following centuries, resulting in the spelling we use today, cobweb. Cob as a word for "spider" had some use in the 17th century in certain dialects, but it was obsolete before J. R. R. Tolkien unearthed it in The Hobbit in 1937. For example, his character Bilbo taunts the giant spiders surrounding him in song: "Lazy Lob and crazy Cob are weaving webs to wind me." (Lob is also an obsolete English word for "spider.") Tolkien also used attercop, a variation of ātorcoppe, in reference to the arachnids:
Old fat spider spinning in a tree!
Old fat spider can’t see me!
Won’t you stop,
Stop your spinning and look for me!
The kind of cob that has corn on it comes from a different Middle English word, cobbe, meaning "head," that was used to describe things having a rounded shape.