“I did” is the simple past, used for a completed action that does not continue into the present; it’s all over. Adverbs and adverbial phrases that modify the verb help us know just how much over it is:
—I did my homework last night.
—I did my homework every night all through school.
—I did my homework on time.
—I did not do my homework.
“I have done” is the present perfect (past perfect would be “I had done”), used for an action performed at some time prior to the present but that may or may not extend into the present. It’s also used for habitual action.
—I have done all my homework for today.
—I have done my homework every night for a week.
—I have always done my own homework.
—I have never done my homework on time.
Tuesday night
Mom: Have you done your homework?
Bob: I haven’t done my homework yet.
Wednesday morning
Sam: Did you do your homework?
Bob: No, I didn’t.
In the first case, the possibility of Bob’s doing his homework is still open. In the second, it’s closed.