His earliest years were passed in the monastery of Siresa, learning to read and write and to practice the military arts under the tutelage of Lope Garcés the Pilgrim, who was repaid for his services by his former charge with the county of Pedrola when Alfonso came to the throne.
During his brother's reign, he participated in the taking of Huesca (the Battle of Alcoraz, 1096), which became the largest city in the kingdom and the new capital. He also joined El Cid's expeditions in Valencia. His father gave him the lordships of Biel, Luna, Ardenes, and Bailo.
A series of deaths put Alfonso directly in line for the throne. His brother's children, Isabella and Peter (who married María Rodríguez, daughter of El Cid), died in 1103 and 1104 respectively.
A passionate fighting-man (he fought twenty-nine battles against Christian or Moor), he was married (when well over 30 years and a habitual bachelor) in 1109 to the ambitious Queen Urraca of León, widow of Raymond of Burgundy, a passionate woman unsuited for a subordinate role. The marriage had been arranged by her father Alfonso VI of León in 1106 to unite the two chief Christian states against the Almoravids, and to supply them with a capable military leader. But Urraca was tenacious of her right as queen regnant and had not learnt chastity in the polygamous household of her father. Husband and wife quarrelled with the brutality of the age and came to open war, even placing Urraca under siege at Astorga in 1112. Alfonso had the support of one section of the nobles who found their account in the confusion. Being a much better soldier than any of his opponents he won the Battle of Candespina and the Battle of Viadangos, but his only trustworthy supporters were his Aragonese, who were not numerous enough to keep Castile and León subjugated. The marriage of Alfonso and Urraca was declared null by the Pope, as they were second cousins, in 1110, but he ignored the papal nuncio and clung to his liaison with Urraca until 1114. During his marriage, he had called himself "King and Emperor of Castile, Toledo, Aragón, Pamplona, Sobrarbe, and Ribagorza" in recognition of his rights as Urraca's husband; of his inheritance of the lands of his father, including the kingdom of his great-uncle Gonzalo; and his prerogative to conquer Andalusia from the Muslims. He inserted the title of imperator on the basis that he had three kingdoms under his rule.
Alfonso's late marriage and his failure to remarry and produce the essential legitimate heir that should have been a dynastic linchpin of his aggressive territorial policies have been adduced as a lack of interest in women. Ibn al-Athir (1166–1234) describes Alfonso as a tireless soldier who would sleep in his armor without benefit of cover, whom when asked why he did not take his pleasure from one of the captives of Muslim chiefs, responded that the man devoted to war needs the companionship of men not women.
The king quarrelled with the church, and particularly the Cistercians, almost as violently as with his wife. As he defeated her, so he drove Archbishop Bernard into exile and expelled the monks of Sahagún. He was finally compelled to give way in Castile and León to his stepson, Alfonso VII of Castile, son of Urraca and her first husband. The intervention of Pope Calixtus II brought about an arrangement between the old man and his young namesake.
In 1122 in Belchite, he founded a confraternity of knights to fight against the Almoravids. It was the start of the military orders in Aragon. Years later, he organised a branch of the Militia Christi of the Holy Land at Monreal del Campo.
Alfonso spent his first four years as king in near-constant war with the Muslims. In 1105, he conquered Ejea and Tauste and refortified Castellar and Juslibol. In 1106, he defeated Ahmad II al-Musta'in of Zaragoza at Valtierra. In 1107, he took Tamarite de Litera and Esteban de la Litera. Then followed a period dominated by his relations with Castile and León through his wife, Urraca. He resumed his conquest in 1117 by conquering Fitero, Corella, Cintruénigo, Murchante, Monteagudo, and Cascante.
In 1118, the Council of Toulouse declared a crusade to assist in the conquest of Zaragoza. Many Frenchmen consequently joined Alfonso at Ayerbe. They took Almudévar, Gurrea de Gállego, and Zuera, besieging Zaragoza itself by the end of May. The city fell on 18 December, and the forces of Alfonso occupied the Azuda, the government tower. The great palace of the city was given to the monks of Bernard. Promptly, the city was made Alfonso's capital. Two years later, in 1120, he defeated a Muslim army intent on reconquering his new capital at the Battle of Cutanda. He promulgated the fuero of tortum per tortum, facilitating taking the law into one's own hands, which among others reassumed the Muslim right to dwell in the city and their right to keep their properties and practice their religion under their own jurisdiction as long as they maintained tax payment and relocated to the suburbs.
In 1119, he retook Cervera, Tudejen, Castellón, Tarazona, Ágreda, Magallón, Borja, Alagón, Novillas, Mallén, Rueda, Épila and populated the region of Soria. He began the siege of Calatayud, but left to defeat the army at Cutanda trying to retake Zaragoza. When Calatayud fell, he took Bubierca, Alhama de Aragón, Ariza, and Daroca (1120). In 1123, he besieged and took Lleida, which was in the hands of the count of Barcelona. From the winter of 1124 to September 1125, he was on a risky expedition to Peña Cadiella deep in Andalusia.
In the great raid of 1125, he carried away a large part of the subject Christians from Granada, and in the south-west of France, he had claims as usurper-king of Navarre. From 1125 to 1126, he was on campaign against Granada, where he was trying to install a Christian prince, and Córdoba, where got only as far as Motril. In 1127, he reconquered Longares, but simultaneously lost all his Castilian possessions to Alfonso VII. He confirmed a treaty with Castile the next year (1128) with the Peace of Támara, which fixed the boundaries of the two realms.
He conquered Molina de Aragón and populated Monzón in 1129, before besieging Valencia, which had fallen again upon the Cid's death.
He went north of the Pyrenees in October 1130 to protect the Val d'Aran. Early in 1131, he besieged Bayonne. It is said he ruled "from Belorado to Pallars and from Bayonne to Monreal."
At the Siege of Bayonne in October 1131, three years before his death, he published a will leaving his kingdom to three autonomous religious orders based in Palestine and politically largely independent - the Knights Templars, the Hospitallers, and the Knights of the Holy Sepulchre, whose influences might have been expected to cancel one another out. The will has greatly puzzled historians, who have read it as a bizarre gesture of extreme piety uncharacteristic of Alfonso's character, one that effectively undid his life's work. Elena Lourie (1975) suggested instead that it was Alfonso's attempt to neutralize the papacy's interest in a disputed succession — Aragon had been a fief of the Papacy since 1068 — and to fend off Urraca's son from her first marriage, Alfonso VII of Castile, for the Papacy would be bound to press the terms of such a pious testament. Generous bequests to important churches and abbeys in Castile had the effect of making the noble churchmen there beneficiaries who would be encouraged by the will to act as a brake on Alfonso VII's ambitions to break it — and yet among the magnates witnessing the will in 1131 there is not a single cleric. In the event it was a will that his nobles refused to carry out — instead bringing his brother Ramiro from the monastery to assume royal powers — an eventuality that Lourie suggests was Alfonso's hidden intent.
His final campaigns were against Mequinenza (1133) and Fraga (1134), where García Ramírez, the future king of Navarre, and a mere 500 other knights fought with him. It fell on 17 July. He was dead by September. His tomb is in the monastery of San Pedro in Huesca.
The testament of Alfonso leaving his kingdom to the three orders was dismissed out of hand by the nobility of his kingdoms, and possible successors were sought. Alfonso's only brother, Ramiro, had been a Benedictine monk since childhood, and his commitment to the church, his temperament and vow of celibacy made him ill-suited to rule a kingdom under constant military threat and in need of a stable line of succession. The step-son of the deceased king, Alfonso VII of León, as reigning monarch and legitimate descendant of Sancho III of Navarre, put himself forward but garnered no local support. The nobility of Navarre aligned behind Pedro de Atarés, the grandson of Alfonso's illegitimate uncle, while the Aragonese nobility rallied around the abbot-bishop Ramiro. A convention was called at Borja to develop a consensus, but there Peter so alienated his own partisans with perceived arrogance that they abandoned him, yet were unwilling to accept Ramiro. The convention broke up without arriving at a compromise and the two regional factions then acted independently.
The choice of the Navarrese lords fell on García Ramírez, Lord of Monzón, descendant of an illegitimate son of García Sánchez III and protégé of Alfonso VII to be their king. The Aragonese took Ramiro out of a monastery and made him king, marrying him without papal dispensation to Agnes, sister of the Duke of Aquitaine, then betrothing their newborn daughter to Ramon Berenguer IV, Count of Barcelona, who was then named Ramiro's heir. "The result of the crisis produced by the result of Alfonso I's will was a major reorientation of the peninsula's kingdoms: the separation of Aragon and Navarre, the union of Aragon and Catalonia and — a moot point but stressed particularly by some Castilian historians — the affirmation of 'Castilian hegemony' in Spain" by the rendering of homage for Zaragoza by Alfonso's eventual heir, Ramon Berenguer IV of Barcelona.
Sometime during the reign of Alfonso II of Aragon, the Battler's grandnephew, a man came forward claiming to be Alfonso the Battler. The only contemporary references to this event are two letters of Alfonso II addressed to Louis VII of France; they were carried to Louis by Berengar, the Bishop of Lleida, but are not dated. According to the second of these, the pretender was then living in Louis's domains, meaning the Principality of Catalonia, which was ruled by Alfonso under Louis's suzerainty. This pretender was an old man (appropriately, since the Battler had died some decades earlier) and Alfonso II expressed confidence that Louis would arrest him at the earliest possible moment and bring him to justice. The first letter supplies sufficient information to date it approximately, since the Bishop sojourned at the court of Louis on his way to Rome. It is known from other sources that Berengar attended the Third Lateran Council in March 1179. The letters were probably written towards the end of 1178 or in January 1179 at the latest. According to an annalist source for the years 1089–1196, the pretender was received with honour and pomp in Zaragoza, Calatayud, and Daroca, which the Battler had conquered, but after it was found out that he was false he was executed before the city of Barcelona in 1181. Modern historian Antonio Ubieto Arteta has hypothesised that the Aragonese lords of the tenencies of Zaragoza, Calatayud, and Daroca — Pedro de Luesia, Loferrench de Luna, Pedro de Castillazuelo (lord of Calatayud), Pedro Cornel (lord of Murillo de Gállego), and the majordomo Jimeno de Artusilla, all of whom disappear between 1177 and 1181 in the documentation of their tenencies — supported, at least inititally, the pretender. These lords also appear in the later legend of the Bell of Huesca, which has no historical basis, as the victims of Ramiro II (1136). Since, historically, they were not active in the 1130s, it is possible that the historically-based legend of the pseudo-Alfonso had some influence on the genesis of the Bell of Huesca.
The earliest chronicle source for the imposture is Rodrigo Jiménez de Rada, writing in the middle of the thirteenth century, who records that there were several legends then current about the death of Alfonso the Battler: some believed he perished in the battle of Fraga, some that his body had never been recovered, others that he was buried in the monastery of Montearagón, and still others that he had fled from Fraga in shame after his defeat and became a pilgrim as an act of penance. Some years later, Rodrigo writes, though he does not give a year, an impostor arose and was received by many as the Battler, though Alfonso II had him arrested and hanged. This is the earliest reference to the impostor's end. The legend was amplified in later years. According to the fourteenth-century Crónica de los Estados Peninsulares, the Battler went on a pilgrimage to Jerusalem, where he lived for many years. The Crónica de San Juan de la Peña also recounts the incident, but it depends entirely on Rodrigo and the Estados Peninsulares. It is not until the seventeenth-century historian Jerónimo Zurita penned his Anales de la Corona de Aragón that new details were added to the legend. Zurita dates the impostor's appearance to the death of Raymond Berengar IV of Barcelona, who had been exercising power in Aragon, and the succession of the child Alfonso II in 1162. The death of the impostor, by hanging, must have occurred in 1163.