The word ‘when’ is primarily used as a conjunction or an adverb in grammar.
As a conjunction, it introduces a clause that indicates the time at which something happens. For example, in the sentence, ‘I will call you when I get home,’ ‘when’ connects the two clauses and indicates the timing of the action.
As an adverb, ‘when’ can be used to ask a question about the time something occurs, like in ‘When will you arrive?’. Here, it prompts the listener to provide a time-related response.
In summary, ‘when’ functions mainly as a conjunction to connect clauses, but it can also serve as an adverb in interrogative sentences.