as it's said from Ayman teacher, the both are right, but the question is when we use them, because even you know the meaning of something in Arabic, you need to know how to use, that's the important.
لم is a negation for the verbs conjugated in the present. The second one, ما is a particle using as a negation or a sense of "that" in English for the verbs conjugated in the past.
مَا فَعَلْتَ هذَا البارحة لأجلي وإنما فقط لنفسك you didn't this for me last day, you just did it for yourself.
مَا قُلْتُ البارحة، كان خطَأ منِّي = that I was saying to you last day, it was a mistake from me.
There are some other senses using as metaphors by using مَا, in otherwise, ما has is common usage than لمْ .