I think the argument is that Muhammad knew just enough about Christianity to be confused and (given the way Christians venerated Mary) incorrectly thought that Mary was a member of the Trinity. However, I’m not sure if that is an accurate statement.
The Rev. Dr. Gilbert Reid writes: ‘As to Christianity as it was represented in Arabia, it was not a clear untarnished theism, but tritheism. The Heavenly Father, Mary the mother of God and Jesus their son, were worshipped as three Gods……Christianity as taught by Christ had lost its identity in the formalism and errors of the church of Arabia……The reformation of Mohammed was thus a return to the first and second commandment of the Prophet Moses, which Jesus himself had taught.’ (‘The Biblical World; Volume 48, Number 1).
Here is the relevant sūrah:
'When Allāh says: ‘Jesus, son of Mary, did you say to people, ‘‘Take me and my mother as two gods alongside God’’?’ he will say: ''May You be exalted! I would never say what I had no right to say……’ (Al-Ma’ida: 116).
As you can see, this verse does not name any particular group. I opine that it is not Christians who are being condemned for taking Mary as a god; it is the Collyridians, and possibly the Mariamites.
William Cook Taylor writes: ‘In Arabia itself some of the worst heresies were propagated: the chief of these were the heresies of the Ebonites, the Nazareans, and the Collydrians, the last of which derived its name from the collyris, or twisted cake offered by them to the Virgin Mary, whom they worshipped as a deity. It is known to all readers of ecclesiastical history that a sect called Mariamites exalted the Virgin to a participation in the Godhead………….’ (‘Readings in Biography: A Selection of the Lives of Eminent Men of All Nations’).
Washington Irving writes: ‘The Mariamites, or worshippers of Mary, regarded the Trinity as consisting of God the Father, God the Son, and God the Virgin Mary. The Collydrians were a sect of Arabian Christians, composed chiefly of females. They worshipped the Virgin Mary as possessed of divinity……’ (‘Mohammed’).
It is also possible (and this is an assumption on my part) that the sūrah is addressing pagan Arabs who – knowing that a statue (or icon) of Mary and her son had been placed in the Ka’aba (where images of Arabian gods were housed) by a Christian visitor to Mecca (in the days before Islam) – had come to believe, wrongly, that both were gods.