Matthew 8:28 -- Legion was cast out, and two men were involved
Mark 5:1-2 -- Legion was cast out, and only one man was involved
With this apparent contradiction between the records in different gospels it must be determined whether this concerns one identical situatioen or different situations which are only similar. If the situations are only similar, there is no contradiction anyways, if it is an identical situation however, the contradiction must be solvable. If one checks the records and puts them into the chronological sequence of events during this part of Jesus Christ's ministry, it becomes evident that really these records are about one identical situation. It is the record of the same casting out of evil spirits on the eastern side of the lake of Genezareth when this devil spirit who called himself "Legion" was cast out by Jesus.
In order to get a complete picture of what happened there, it is necessary to include the record in Luke 8:26-39 in our considerations. In Matthew, two men are mentioned who were possessed of evil spirits, in Mark and Luke however only one man is mentioned. A close look shows that Jesus was met first by one man who came from the graves when they arrived on the shore after the crossing of the sea (cp. Mark 5:2); and soon after this another man who was plagued by an evil spirit came to him from the city (cp. Luke 8:27). The records in Mark and Luke mention only one man each whereas the record in Matthew gives a description of the whole event with both men in the style of a summary. This event involved a total of two men who were possessed with evil spirits and who were now healed by Jesus Christ and who received deliverance. One gospel (Matthew) speaks of both men, the two othe gospels speak of only one of the two men each.
The Word of God has no contradiction regarding these records, instead the various records complement each other to one harmonious whole.