The origins of the name are controversial and are attributed by some authors to ancient Celtic tribes. According to a local legend, King Afonso I (Afonso Henriques) exclaimed to incite his troops storming the stronghold: Coragem! Já estamos com o pé nela! (Courage! We have already set a foot in it!). A more plausible hypothesis is, however, that penela is a diminutive of penha, a place selected to build a fortress on.
It is believed that the area was already inhabited before the Roman occupation, and later a Roman watchtower was erected to oversee the nearby road connecting Mérida, Conímbriga and Braga. There is, however, no strong evidence to support this hypothesis, as well as any possible fortifications built here in times of Muslim occupation of the Iberian Peninsula.
Penela's involvement in the Christian Reconquista starts with the conquest of Coimbra region by the troops of Ferdinand I of León (Fernando Magno) in 1064. In the next year the already walled settlement was granted a status of town along with four other nearby villages. The testament of count Sesnando Davides (1087), to whom the king delegated the administration of Conimbricense county, affirms that the count ruled the castle of Penela and the people in the area.
During the successive Muslim offensives in 1116 and 1117 castles Castelo de Miranda do Corvo and Castelo de Santa Eulália were conquered and destroyed, which caused the desertion of castle Castelo de Soure. These castles provided a line of defence for Coimbra region and now castle Penela was threatened. Perhaps this position was also lost, which would explain king Afonso I Henriques assaulting it in 1129, although this version is not supported by any sources. There are documents attributed to the period when a Chart of Foral was granted to the town, which reference a donation of a house inside the castle dated by 1145.