The correct placement for a comma in the sentence "Maria needed to go to the library but I wanted to go to the mall" is between the words "library" and "but."
The revised sentence would be: "Maria needed to go to the library, but I wanted to go to the mall."
This comma is used to separate the two independent clauses.