Option D is the correct answer because "were" is the second person singular past form used for a person when being asked something,it is also the plural past in general, but here it is the second person singular.
"doing" is correctly used because it is the present participle of "do" and is correct because the speaker wants to ask what was he doing in the past.
Option A is incorrect because "did" is generally used in the beginning of the question trying to confirm a particular thing, or it would be correct if the statement was,"what did you do at 5pm yesterday".
Option B is incorrect because it is in past continuous tense, and it would be correct if the statement was "what have you been doing "since" 5pm yesterday, he" hence it is incorrect.
Option C is incorrect because although "would" is the past tense of "will" which is in future tense, but the statement is made in past tense.
Option E is incorrect because "will" is in future tense while the statement is in past tense.