Names given to the Spanish language
Formally speaking, the national language of Spain, the official Spanish language, is the Castilian language (as opposed to regional Spanish languages like Galician, Catalan, Asturleonese and Basque). As such both names, "español" and "castellano", have distinct and independent meanings that may be required for clarity in some specific contexts.
Generally speaking, though, both terms can be used to refer to the (national) Spanish language as a whole, with a preference for one over the other that depends on the context or the speaker's origin. "Castellano" (as well as "Castilian" in English) has another, more restricted, meaning, relating either to the old Romance language spoken in the Kingdom of Castile in the Middle Ages, predecessor of the modern Spanish language, or to the variety of Spanish nowadays spoken in the historical region of Castile, in central Spain.
Castilians
Castilian ("castellano"), that is, Spanish, is the native language of the Castilians. Its origin is traditionally ascribed to an area south of the Cordillera Cantábrica, including the upper Ebro valley, in northern Spain, around the 8th and 9th centuries; however the first written standard was developed in the 13th century in the southern city of Toledo. It is descended from the Vulgar Latin of the Roman Empire, with Arabic influences, and perhaps Basque as well. During the Reconquista in the Middle Ages, it was brought to the south of Spain where it replaced the languages that were spoken in the former Moorish controlled zones, such as the local form of related Latin dialects now referred to as Mozarabic, and the Arabic that had been introduced by the Muslims. In this process Castilian absorbed many traits from these languages, some of which continue to be used today. Outside of Spain and a few Latin American countries, Castilian is now usually referred to as "Spanish".