"El Salvador" literally means "The Savior" in Spanish. The name is believed to have originated from a vision experienced by Spanish conquistador Pedro de Alvarado, in which he saw Christ carrying a banner with the word "El Salvador" inscribed on it.
"San Salvador" is named after Jesus Christ the Savior (El Divino Salvador del Mundo in Spanish). The city's full name is "La muy noble y leal ciudad de San Salvador", which translates to "The very noble and loyal city of San Salvador".
Therefore, "El Salvador" refers to the entire country, while "San Salvador" refers specifically to its capital city.