Rashi, on this verse tells us that נעצר לפני ה'- who remained before G-d (or "detained before the L-rd" means that he tarried before the Tent of Meeting to engage in the study of Torah.
A similair idea is conveyed by the Sforno in his commentary on Leviticus 23:36:
עצרת היא. The concept of atzeret is something apart from the concept of shvut. The latter pertains to abstaining from ordinary secular activities, whereas the former entails spending a certain amount of time performing holy tasks, studying Torah, engaging in communal prayer, etc. The expression נעצר occurs in this context in Samuel I 21:8, “and there was a man, one of Saul’s officials detained [נעצר] before the Lord, etc.”
The Radak offers a similair explanation. As does Rabbi Menachem Mendel Kasher in his work תורה שלמה.
The Talmud (Sanhedrin 93b) offers another explanation, based on the word for one "echad".
The Talmud says this is to show us that Doeg was meyuḥad. Meaning, he was "the most notable".
The Gemara asks: From where do we derive that it was Doeg who listed the virtues in this verse? The Gemara answers that it is written here: “And one [eḥad] of the servants answered,” meaning the most notable [meyuḥad] of the servants. And it is written there: “And a certain man of the servants of Saul was there that day, detained before the Lord, and his name was Doeg the Edomite, the chief of the herdsmen that belonged to Saul” (I Samuel 21:8).