Yes, but it wouldn't do anything
The Archlich can use a legendary action to cast an at will spell. The casting time of the spell is not specified, so the fact that Counterspell requires a reaction does not invalidate it. So yes, the Archlich could definitely cast Counterspell as a legendary action.
But most of the time, it wouldn't do anything.
Counterspell's timing specifies when it must be cast to be effective:
Casting Time: 1 reaction, which you take when you see a creature within 60 feet of you casting a spell (PHB, p. 228
To successfully stop a spell from being cast, Counterspell must be cast while another creature is casting a spell: not when they have already cast it. And if a creature is currently casting a spell with a casting time of an action, a bonus action, or a reaction, then their turn is not over. Only once their action, bonus action, and/or reaction is completed (and they have finished doing everything else they wanted to do on their turn) have you reached the end of their turn. And since:
Only one legendary action option can be used at a time and only at the end of another creature's turn.
that tells us that by the time the Archlich has an opportunity to cast Counterspell as a Legendary Action, the Counterspell will no longer be effective. (Once a spell has been cast, you want Dispell Magic, not Counterspell, to remove it). So although the Archlich could certainly spend their Legendary Action casting Counterspell, they couldn't actually foil a PC's spell with it (unless they used their Reaction to cast it).
NOTE: There are some rare exceptions. If a PC is casting a spell with a longer casting time (such as a ritual, or a spell with a casting time of 1 minute), the Archlich could Counterspell it with a legendary action. But spells with longer casting times are rarely cast in combat (as they'd take 10+ rounds), which is the only time that Legendary Actions tend to come up. Erik pointed out another possible exception, which is that spellcasting often takes more than one turn to complete when you are under the effects of a Slow spell, so your spellcasting could be counterspelled at the end of your turn if that was the case (but as the archlich in the adventure you mentioned doesn't have access to the Slow spell, that scenario is also unlikely to come up). And since it's an edge case that's likely to come up, I want to point out that a Readied spell can't be countered since it has already been cast (just not released).