Either.
Past simple. 2 completed actions in the past. I didn't understand because I didn't listen.
Past continuous. 1 past action within another action in the past. I didn't understand because I wasn't listening.
Both are grammatically correct.
If you want to emphasise duration or make it sound like you repeatedly failed to listen - use the continuous form. If you're simply imparting information then the past simple will suffice.
More examples:
I didn't work yesterday as I felt ill all day.
I didn't work yesterday as I was feeling ill all day.
(there really isn't any difference here as the 'all day' tells you the duration and could be emphasised nicely - I was feeling ill ALL day!
I didn't remember the instructions because I didn't pay attention to the manager.
I didn't remember the instructions because I wasn't paying attention to the manager.
(I can't see any difference here either, in meaning)
If we turn it around>
Why didn't you remember the instructions?
Because I didn't listen!
Because I wasn't listening!
(no difference)
There are, of course, times you NEED the continuous form, but not so far in what we've talked about.