Hi Carlo, I don't speak Italian, so I don't know if this is a direct translation or not, but there are two main ways you can say this:
"What did I do?" This way is more indefinite. It may refer to any moment in the past.
"What have I done?" This way is usually more immediate. It's more often (although not always) used to refer to an event that just ended. It also usually comes across more negatively, whereas "what did I do" can be used to refer to anything you did/didn't do.
Here are some examples...
A: You're going to burn in hell!
B: What did I do?
Here, B is simply wondering why A is condemning him to eternal damnation.
A: There's rat poison on the floor and your dog is sick!
B: Oh no, what have I done? Why didn't I put the rat poison away?
Here, B is expressing regret for a mistake he made that led to a consequence he just discovered.
I hope my answer helps. Please let me know if it doesn't.