Actually Jesus question to Mary, “What have I to do with you?” is an idiomatic expression of the Middle East and means simply, “Why are you troubling ME with this matter?” or “It's not something I should concern myself with”.
The same expression is used elsewhere in the Bible such as by Elisha at 2 Kings 3:13: “And Elisha said unto the king of Israel, What have I to do with thee?”