The question is grammatically correct. The auxiliary verb 'did' is used correctly with the base form of the main verb 'come' in an interrogative sentence about a past event.
Answer: When did he come home?