We use when as a conjunction meaning 'at the time that'. The clause with when is a subordinate clause (sc) and needs a main clause (mc) to complete its meaning.
What grammar is when?
The word “when” has multiple functions. It can be used as an adverb, conjunction, pronoun, and noun. This word is categorized as an adverb because it modifies a verb, and adjective, or another adverb by indicating the time.
Is when a preposition word?
In traditional grammar when is a subordinating conjunction; in the Cambridge Grammar of the English Language it's a preposition.