"It was I who was wrong" (note, match the tenses, Was / Am is not correct)
It sounds ok, like you are correcting someone who thought they were mistaken.
other ways you could say this:
Actually, it was my mistake
The mistake was mine
I'm so sorry, i think it was my error and not yours (that caused the problem)