Why do spiders spin webs?
A fossil spider
An orb web
By about 300 million years ago, spiders evolved silk and spinnerets and could spin webs. They probably ate other early arthropods, and lived on the ground among the big ferns and mosses that grew all over the earth at this time.
At about the same time, the first bigger land animals began to come out of the water: frogs and salamanders. These ate spiders.
The earliest evidence of an orb web, the round kind that is the most normal kind of spider web, comes from one that was preserved in amber about 110 million years ago, but spiders were probably making these webs as early as 135 million years ago. That's because flying insects like grasshoppers and bees were evolving at this time, and so the spiders evolved webs to catch them. At the same time, birds also evolved that could eat the bees and grasshoppers - and also eat spiders.