The town finds its origin in the beginning of the mining operations of the Sierra Almagrera in the early nineteenth century, when there was a significant increase in the population of the area as it gradually became the most important of the Bédar jurisdiction, to which it belonged until August 1924. The origin of the name is thought to have come from a nineteenth-century family, however, it has also been suggested that it originates from a Captain Gallardo, who may have settled in the first house in the area and given rise to the town.
At that time, and according to La Gaceta of Madrid (August 21, 1924), Miguel Primo de Rivera decreed the formation of an independent municipality of Bédar formed by the Barriada de Los Gallardos, Los Pagos de Las Pastoras, Tejera, Almansa, Rambla de Hornos, Huerta de Don Juan, Los Caparroses, Las Norias, Alfaix, Los López, Los Rodríguez, Los Llanos, Los Collados and Almocaizar, with the first being the capital of the municipality. This Royal Decree was provoked by the request of the residents of these settlements to segregate from Bédar. The new municipal arrangement was justified by the existence of schools, commerce and independent industry.
The town flourished due to its mining activity, still visible today in the fragments of the railway that once linked Bédar and Garrucha. Once mining activity in the area fell into crisis, the town took to agriculture. The flour mill was one of three that existed in the entire province and supplied the bakeries of the region.