Name and why it is called so
The surah takes its name from the word al-fil (the elephant) in its first verse, "Alam tara kayfa fa'ala rabbuka bi-ashabil-fil" (Have you not seen how your Lord dealt with the People of the Elephant?). The People of the Elephant were the army that marched on Mecca with elephants. The Quran does not mention the army's leader or the details, because the event took place about forty years before the revelation of the Quran and the Arabs knew it well.
Time of revelation and background
This is a Meccan surah. According to the commentators and historians, Abraha was the deputy ruling Yemen for the Christian kingdom of Abyssinia. He built a magnificent church in Sana'a so that the Arabs would turn to it instead of the Kaaba. When this aim failed, he set out with a large army, elephants included, to destroy the Kaaba, but near Mecca his army was destroyed by Allah's command. The Arabs call that year the Year of the Elephant ('Am al-Fil), and according to most biographers of the Prophet, the Prophet ﷺ was born in that same year.
The Prophet ﷺ himself mentioned this event. Sahih al-Bukhari reports from Abu Hurairah (may Allah be pleased with him) that on the day of the Conquest of Mecca, the Prophet ﷺ said in his sermon that Allah had held back the elephant from Mecca and had now given His Messenger and the believers power over it. Likewise, on the journey of Hudaybiyah, when his she-camel knelt down, he ﷺ said that she had been held back by the One who held back the elephant.
Main themes
The surah begins with a question: Have you not seen how your Lord dealt with the People of the Elephant? Then it says that He made their whole plot go astray, sent against them flocks of birds that pelted them with stones of baked clay, and made them like eaten-up straw. The lesson of the tafsir of Surah Al-Fil is that Allah Himself protects His House, that pride in power and means is helpless before His decree, and that Quraysh were bound to remember this favor and worship Him alone.