The Cochabamba valley was inhabited for over a thousand years due to its fertile productive soils and climate. Archaeological evidence suggests that the initial inhabitants were of indigenous ethnic groups: Inca, Tupuraya, Mojocoya, Omereque, and Tiwanaku inhabited the valley at times before the Spanish arrived.
The first Spanish inhabitant of the valley was Garci Ruiz de Orellana in 1542. He purchased the majority of the land from local tribal chiefs Achata and Consavana through a title registered in 1552 at the Imperial City of Potosí. The price paid was 130 pesos. His residence, known as the House of Mayorazgo, stands in the Cala Cala neighbourhood.
The city, called Villa de Oropesa, was founded on 2 August 1571 by order of Viceroy Francisco de Toledo, Count of Oropesa. It was to be an agricultural production centre to provide food for the mining towns of the relatively nearby Altiplano region, particularly Potosí which became one of the largest and richest cities in the world during the 17th century — funding the vast wealth that ultimately made Spain a world power. With the silver mining industry in Potosi at its height, Cochabamba thrived during its first centuries. The city entered a period of decline during the 18th century as mining began to wane.
In 1786, King Charles III of Spain renamed the city to the 'loyal and valiant' Villa of Cochabamba. This was done to commend the city's pivotal role in suppressing the indigenous rebellions of 1781 in Oruro by sending armed forces to Oruro to quell the uprisings. Since the late 19th century it has again been generally successful as an agricultural centre for Bolivia.
The 1793 census shows that the city had a population of 22,305 persons. There were 12,980 mestizos, 6,368 Spaniards, 1,182 indigenous natives, 1,600 mulattos and 175 African slaves.
In 1900, the population was 21,886.
Besides a number of schools and charitable institutions, the diocese has 55 parishes, 80 churches and chapels, and 160 priests.
In 1999 and 2000, large-scale protests reversed the privatisation of the city's water supply.
In January 2007 city dwellers clashed with mostly rural protestors, leaving four dead and over 130 injured. The first democratically elected Prefect of Cochabamba, Manfred Reyes Villa, had allied himself with the leaders of Bolivia's Eastern Departments in a dispute with President Evo Morales over regional autonomy and other political issues. The protestors blockaded the highways, bridges, and main roads, having days earlier set fire to the departmental seat of government, trying to force the resignation of Reyes Villa. Citizens attacked the protestors, breaking the blockade and routing them, while the police did little to stop the violence. Further attempts by the protestors to reinstate the blockade and threaten the government were unsuccessful, but the underlying tensions have not been resolved.
In July 2007, a monument erected by veterans of January's protest movement in honour of those killed and injured by government supporters was destroyed in the middle of the night, reigniting racial conflicts in the city.
In August 2008, a nationwide referendum was held. The prefect of Cochabamba, Manfred Reyes Villa, was not confirmed by the voters of the department.