Verse 40: Allah (swt) then gives us a summary of the punishment 
that He sent. On some of them, we sent a violent storm, some were swallowed by the earth and some we drowned. This was a result of them doing dhulm on themselves. 
Verse 41. It is from this verse that we derive the name of this Surah, Surah al-Ankabut. Examples of those people who take protectors 
besides Allah (swt), are like the house of the spider. What can be more weaker and more flimsy than the house of a spider. 2 interesting points need to be discussed here, does this verse refer to the event
 of the Hijrah, when the Holy Prophet (saww) was travelling from Makkah to Madinah and the spider appeared at the door and shooed away the mushrikeen? No, this is a Makki Surah and does not relate to this event
There are many other insects whose homes are more weaker 
and flimsier than a spider. Why is the spider mentioned? The Muffassireen have mentioned that since the Holy Qur’an is a guide for all the people, (regardless of where they are from), and they 
all know the flimsiness of the spider’s web, it is easier for them to 
understand the frailty of the home of the spider.
Tafsir Surat al-Ankabut 4