The Arcateenian Mary had been travelling with her prison guard with a transporter. In 1812, she killed him and arrived in Cardiff. She took over the human Mary's body presumably killing her. She took on the human Mary's identity.
To sustain herself, "Mary" fed off human hearts, starting with the soldier that had chased the original Mary. The transporter was left behind and the city of Cardiff grew over it.
In 2007, Torchwood Three found the transporter. She pursued a relationship with Toshiko Sato, intending to use her to get the transporter back. She gave Tosh an Arcateenian telepathy pendant and taught her how to use it. She continued to gain Toshiko's trust, eventually seducing her. Inside the Torchwood Hub, she had Toshiko at knifepoint demanding the transporter back. Jack Harkness tricked Mary, and killed her by transporting her to the centre of the sun. (TV: Greeks Bearing Gifts)