The sentence combines two independent clauses:
✔ Why did you go there?
✔ Why did you do that?
In a single sentence without any ellipsis for parallel structure, it would be the following:
✔ Why did you go there and why did you do that?
The shortened version can be analyzed in two different ways.
Ellipsis
When we use ellipsis with parallel structures, we can remove repetitive parts of sentences, because the meaning without them is still clear:
Why did you go there and why did you do that?
In short:
✔ Why did you go there and do that?
Combined action
A combination of two things can be considered a single action at times.
For example:
Drinking and driving is illegal.
It can be considered a single combined action that contains two parts:
(Drinking and driving) is illegal.
The same analysis could be performed with the sentence in the question:
Why did you (go there and do that)?
In short:
✔ Why did you go there and do that?
There is no similar analysis of the second sentence in the question (or any analysis) that makes it grammatical. However you combine the two things, the conjugation of the verb used in the second part of the sentence is incorrect:
✔ Why did you do that?
✘ Why did you did that?