Castilian is the historical name of the Spanish language, which originated in the old Spanish kingdom of Castile.
In the past, North Castilian used to be considered, by the Spanish Royal Academy, the "model" or "yardstick" for the Spanish spoken in the two dozen or so Spanish-speaking countries. North Castilian, however, preserves the distinction between the two phonemes currently expressed as /s/ (alveolar sibilant, written s) and /T/ (interdental fricative written z or ce,ci) (e.g. casa=house vs. caza=hunting), that is not used elsewhere since the 16th century.
Castilian is not to be confused with ceceo or seseo. The term seseo is used for the Spanish of the Americas, Canary Islands, and some Andalusian Spanish variants that mixed /s/ and /T/ into /s/, while the term ceceo is used for the other Andalusian Spanish variants that mixed /s/ and /T/ into /T/.
While many Spaniards generally refer to their language as espaņol, in Mexico, Central and South America the language (however pronounced) is often called castellano (Castilian) because the word espaņol is used for "Spaniard". And then in Spain, most Spaniards of those (about 1 of every 5) whose native tongue is not Spanish call Spanish castellano as well -- and even those Spaniard who speak Spanish as a first language use the word castellano interchangeably with espaņol.
In schools, the official name of the language tends to be castellano rather than espaņol, mainly because there are many regions where there are two mother tongue subjects - castellano and the other co-official language (Catalan, Basque or Galician).