(1) Da Vinci's portrait of the Last Supper took a snapshot of an animated scene recorded in the gospel books (specifically John 13:22 in John 13:21-25). The one on Jesus' right side was John, not Mary Magdalene. There are two reasons for this assertion.
First, there were only 13 persons in the portrait, Judas the traitor was with them for the supper according to all four gospel books. In Da Vinci's portrat, Judas the traitor was sitting (actually reclining per Jewish tradition) second from Jesus' right side, holding a purse (a sure identifier for him since he was said to be somebody like a treasurer for the gang of 12 of Jesus). Judas was yet to go out to betray Jesus (John 13:30).
Second, the one on Jesus' right was clearly John the beloved apostle (John 13:23) since the third person on the right was Peter who leaned over to ask John who the traitor was (John 13:24). After this, John leaned to the bosom of Jesus and asked who the traitor was (John 13:25), which was not in the snapshot of the portrait.
To suggest the first person on Jesus right was Mary Magdalene was ludicrous. Where was the missing disciple then since Judas the traitor had not yet walked out until later in the night (John 13:30)?
(2) On the morning of Jesus' resurrection, there were apparently several women (Luke 24:1; 23:49,56) who went to visit the tomb and met the risen Lord. Matthew named two of them, both were called Mary, one was Mary the Magdalene (Matthew 28:1). The other Mary was the mother of James (Mark 16:1). Mark who was regarded as the first and earliest gospel writer further pointed out another woman named Salome (Mark 16:1). John named only Mary Magdalene (John 20:1).
As for why Mary Magdalene was shown to be around Jesus and showed great affection, that is simple to answer. Jesus once cast out seven demons from her. She was free from demonization and appreciative of Jesus' healing. Some suggest that Mary Magadalene was one of the many among Jesus' traveling companions. That might well be so, given the gospel books' explicit record (Luke 8:3; Matthew 27:55).
Just because a very appreciative woman like Mary Magadalene followed Jesus more visibly than many others does not mean she was the wife of Jesus.
(3) Finally, even if Da Vinci portrait hid a code of some sort, that was an opinion entitled to Da Vinci. Just because one has a hidden intention does not mean that intention reflects reality.