Why did they put Santa Clara mission in Santa Clara?

Because people would have gotten all confused if they'd put it in Santa Barbara.

Anyway, the question has it exactly backwards. The Spanish missionaries were setting up a chain of missions a day's travel apart (along, or at least close to, what is today the route of El Camino Real). They didn't put the Santa Clara mission in Santa Clara... they put the Santa Clara mission near an existing native American settlement, and the city grew up around it and took its name from the mission.
Because people would have gotten all confused if they'd put it in Santa Barbara.

Anyway, the question has it exactly backwards. The Spanish missionaries were setting up a chain of missions a day's travel apart (along, or at least close to, what is today the route of El Camino Real). They didn't put the Santa Clara mission in Santa Clara... they put the Santa Clara mission near an existing native American settlement, and the city grew up around it and took its name from the mission.