On one hand, the DM can do whatever they want; they are the DM. But, by the actual rules in the book…
No, this is not how the rules work as written
The description of Initiative states:
At the beginning of every combat, you roll initiative by making a Dexterity check.
When the creatures are “readying an attack”, this is already part of the combat; therefore, Initiative should have been rolled, and you would not be surprised by the attack. This interpretation is backed up in this similar Q&A.
Note that the creatures are still hidden (if you didn’t perceive them), so, even though you are not surprised by the combat, not necessarily you know where the creatures are. Even if they are hidden, the Alert feat also states (PHB, p. 165):
Other creatures don’t gain advantage on attack rolls against you as a result of being unseen by you.
By the way, in your text, you mention that the swarm of insects
immediately attacked him, dealing (x) damage.
From this, it is unclear whether the DM rolled an attack roll as well. Even if surprised and attacked by a hidden creature, the creature still has to hit with the attack roll before dealing damage.
Talk to your DM
It seems this situation has upset you. You have taken a feat, giving up an ASI, with the sole objective of such situations not happening, and then the DM pulls up something not entirely backed by the rules that makes the entire point of taking such a feat get thrown away.
Talk to your DM. Tell them that how they handled this situation was upsetting. Explain that the point of taking such a feat is to avoid these situations, and that by house ruling otherwise, they are harming your character’s concept. At worst, ask them to let you change the feat, if they are going to keep doing such things, because your expectations when building the character were different.