The idea that Mary Magdalene was a prostitute comes from the account given in Luke 7:36-50 of a woman who anointed the feet of Jesus with her tears and ointment. She is described as ‘a woman of the city who was a sinner’, so this woman may have been a prostitute. Jesus told her to ‘Go in peace’. For some reason, people have thought that this woman was Mary Magdalene, although there is nothing in the Bible to suggest that.
The only mention of Mary Magdalene in any of the gospels before the crucifixion of Jesus Christ is in Luke 8:2, where she is described as one ‘from whom seven demons had gone out’. With a number of other women she travelled around the country with Jesus and his Apostles.
It is unlikely that Luke would have described these two women in such completely different ways if they were, in fact, the same woman.
See also the related question “How many times was Jesus anointed by a woman?”