Why does the gospel of Matthew claim that it was Mary Magdalene who annointed Jesus's feet with oil and Luke claim it was an unnamed woman?
In the Luke account of Jesus being anointed, a woman is recorded as being 'a sinner' and she is unnamed. In the Matthew account of Jesus being anointed, a woman is identified as Mary, the sister of Martha and Lazarus.
Examination of these two accounts shows that it is impossible to prove that they are the same incident. The details are so worded that one cannot say, categorically, that these are not two accounts of different events.
Thus the unnamed 'sinner' cannot be identified. Whoever she is or is not, it cannot be proven.
All we know of this unidentified woman is that she anointed Jesus prior to his sufferings, death and burial.
In so doing, she was successful, anointing Jesus beforehand, for the women who went to the tomb with spices, after his decease, were not able to administer them, for Jesus was risen from the dead by the time they got there.
The four gospels are clearly demonstrating different aspects of Jesus Christ and his ministry on earth. The details supplied in the four aspect-accounts are selected with an overall purpose in mind. Different events, sometimes not in consecutive order of occurrence, are gathered together and presented in juxtaposition in order to convey a particular aspect of the Person and Ministry of Jesus Christ, the Son of God.
Believe it was Irenaeus who provided the first reasoning for four gospels, rather than one or two or more. He was writing against Marcion who only wanted one gospel (Lukes).
- It is not possible that the Gospels can be either more or fewer in number than they are. For, since there are four zones of the world in which we live, and four principal winds,3449 while the Church is scattered throughout all the world, and the “pillar and ground” of the Church is the Gospel and the spirit of life; it is fitting that she should have four pillars, breathing out immortality on every side, and vivifying men afresh. A.H. III, XI
He will continue in like manner with scripture examples to support his reasoning.
For the cherubim, too, were four-faced, and their faces were images of the dispensation of the Son of God. For, [as the Scripture] says, “The first living creature was like a lion,” symbolizing His effectual working, His leadership, and royal power; the second [living creature] was like a calf, signifying [His] sacrificial and sacerdotal order; but “the third had, as it were, the face as of a man,”—an evident description of His advent as a human being; “the fourth was like a flying eagle,” pointing out the gift of the Spirit hovering with His wings over the Church. And therefore the Gospels are in accord with these things, among which Christ Jesus is seated. -ibid-
So to answer the OP, the idea is that the gospels must be taken as a whole, rather than as a contradiction. Each has their purpose as a piece. What was important to one may not have the same importance to another. If the example given is of the same event and one names the woman and the other doesn't, then it is nothing more or less an invitation to read more from the remainder of the picture.
EDIT: My answer here follows the lead of the question, which does not question whether there are differences in the gospels, but it asks "WHY" there are differences. In other words, any answer to this question must already accept the premise that differences exist.
Therefore, if you take issue with my statement that there are differences, and my examples to validate it, then you need to move on to a different question and not engage in this one. If you accept the premise and want to read a potential explanation for it, then read on.
There are a number of differences and contradictions between the gospels. Let's not pretend there aren't.
To tell or not to tell
Matthew 28:8 8 So the women hurried away from the tomb, afraid yet filled with joy, and ran to tell his disciples.
Mark 16:8 8 Trembling and bewildered, the women went out and fled from the tomb. They said nothing to anyone, because they were afraid.
To staff, or not to staff
Mark 6:8-9 8 These were his instructions: “Take nothing for the journey except a staff—no bread, no bag, no money in your belts. 9 Wear sandals but not an extra shirt.
Luke 9:3 3 He told them: “Take nothing for the journey—no staff, no bag, no bread, no money, no extra shirt.
And my personal favourite...
To hang, or not to hang...
According to Matthew, Judas returned the money to the chief priests, who then used the money to purchase the "Field of Blood". Matthew also says that Judas hanged himself and that the reason the field is called "Field of Blood" is because it's used as a burial place for foreigners.
Matthew 27:5-8 5 So Judas threw the money into the temple and left. Then he went away and hanged himself. 6 The chief priests picked up the coins and said, “It is against the law to put this into the treasury, since it is blood money.” 7 So they decided to use the money to buy the potter’s field as a burial place for foreigners. 8 That is why it has been called the Field of Blood to this day.
That's not what Paul said. According to Paul Judas never returned the money but instead bought a field with it where he died by falling, not by hanging. He also says this is the reason it's called "Field of Blood".
Acts 1:18-19 18 (With the payment he received for his wickedness, Judas bought a field; there he fell headlong, his body burst open and all his intestines spilled out. 19 Everyone in Jerusalem heard about this, so they called that field in their language Akeldama, that is, Field of Blood.)
The reason we see differences between the gospels is because the gospels were written by men, not by God. Yes, these men were filled with the spirit (that is the life of God) but that doesn't mean they had perfect memories, nor does it mean that God possessed their bodies when they wrote. Simply put, there are mistakes in their writings.