The word "لم" (lam) in Arabic grammar is classified as a حرف نفي وجزم (a particle of negation and jussive governance). It performs two grammatical functions simultaneously:
النفي (negation): it negates the action of the verb, indicating that the action did not happen in the past.
الجزم (jussive governance): it puts the imperfect verb (الفعل المضارع) into the jussive case (المجزوم), changing the verb's ending - typically by applying a sukun on the final letter.
For example: لم يذهبْ (he did not go) - the verb يذهب receives a sukun on the final letter because of لم.
لم is not a noun (اسم), not a verb (فعل), and not an adverb (ظرف). It is a حرف (particle) - specifically one that combines negation with jussive case governance over the imperfect verb.