Octavian of Tusculum was the son of Alberic II of Tusculum, count of Spoleto; Alberic II carried himself as the de facto prince of Rome, as had done his predecessors of the same dynasty, particularly Alberic II's mother Marozia and her younger sister Theodora. The dynasty had managed to install several of their own or under their control as Popes, and Octavian ascended to the papal chair rather young, somewhere between the ages of 17 and 25 (the Latin is unclear), taking on the name of John XII.
John had a considerably harder time acting as Pope and prince of Rome than his predecessors of the same dynasty. He could not keep the powerful Roman nobility as easily under control, and allegedly had a hard time keeping his personal impulses in check as well.
It's said that he always signed as Octavian when dealing with matters befitting the prince of the Romans and always signed as John when dealing with matters of the Church.
Early in his pontificate, John marched with armies from Tusculum and Spoleto towards the Lombard duchies of Beneventum and Capua, presumably to reclaim territories for the Papal State; Beneventum and Capua called in duke Gisulf of Salerno as well, at which point John retreated and signed a treaty promising that in exchange for Gisulf's non-interfence he'd give up any papal claims on Salerno.
Most importantly, John soon acquired a rival with the likes of whom the princes of Tusculum before Octavian never had to contend: the man who came to be known as Otto the Great.
That started when, around at the same time the deal with Salerno happened, King Berengar II of Italy attacked the Pope's territories. John therefore called Otto, then King of Germany, to his defense, and had him crowned emperor in exchange for the vow to protect the Pope and a new treaty, the Diploma Ottonianum or Privilegium Othonis, formally recognising the Papal States as independents, though the treaty was still restrictive towards the Pope on several accounts: after all, Otto had taken to routinely electing people as bishops or other members of the clergy before granting them lands or responsibilities, as a way to eschew dynastic disputes and ensure loyalty to him personally, and he did not intend to give this up, nor to concede any more authority of any sort to the Pope than what he deemed strictly necessary.
Otto left, allegedly recommending that John give up his secular, dissolute, lascivous way of life; he then quickly began to repel Berengar's armies with ease.
This meeting, and the show of power that Otto's armies were demonstrating against Berengar's, clearly left their mark on Octavian, who sent envoys to the Magyars and the Byzantine Empire to form a league against Otto, and even began negotiations with Berengar's son Adalbert.
Word of this reached Otto when papal ambassadors en route towards Adalbert were captured by Otto's forces; Otto sent deputies to find out what was happening in Rome. John, on the other hand, sent new envoys, this time to Otto, that claimed that the ones who had been captured while travelling towards Adalbert had been simply meaning to discuss reforms internal to the papal court itself.
Actual negotiations with Adalbert, however, did not cease, and when Otto, who had in the meanwhile effectively defeated and imprisoned Berengar, learnt that Adalbert had been granted access to the city in 963, he laid siege to Rome.
Octavian personally fought in battle, and initially drove Otto's forces across the Tiber River, but he and Adalbert fled to Tibur with the treasury once they realised there was no way they could keep defending the city for much longer.
Otto summoned a synod, challenging John to come forth and defend himself from the charges that would be raised against him. John simply replied that he'd excommunicate all who opposed him. The synod deposed him and elected Leo VII as the Pope. Here's how pro-Otto contemporary chronicler Liudprand of Cremona described the Synod of 963:
"Then, rising up, the cardinal priest Peter testified that he himself had seen John XII celebrate Mass without taking communion. John, bishop of Narni, and John, a cardinal deacon, professed that they themselves saw that a deacon had been ordained in a horse stable, but were unsure of the time. Benedict, cardinal deacon, with other co-deacons and priests, said they knew that he had been paid for ordaining bishops, specifically that he had ordained a ten-year-old bishop in the city of Todi ... They testified about his adultery, which they did not see with their own eyes, but nonetheless knew with certainty: he had fornicated with the widow of Rainier, with Stephana his father's concubine, with the widow Anna, and with his own niece, and he made the sacred palace into a whorehouse. They said that he had gone hunting publicly; that he had blinded his confessor Benedict, and thereafter Benedict had died; that he had killed John, cardinal subdeacon, after castrating him; and that he had set fires, girded on a sword, and put on a helmet and cuirass. All, clerics as well as laymen, declared that he had toasted to the devil with wine. They said when playing at dice, he invoked Jupiter, Venus and other demons. They even said he did not celebrate Matins at the canonical hours nor did he make the sign of the cross. "
Then again, it's not like Liudprand was the only contemporary writer to have little esteem of John's morals. For instance, another contemporary chronicler, Ratherius of Verona, wrote:
"What improvement could be looked for if one who was leading an immoral life, who was bellicose and perjured, and who was devoted to hunting, hawking, gaming, and wine, were to be elected to the Apostolic See?"
An initial revolt in favour of John as the Pope was violently suppressed by Otto's forces. Eventually, the emperor left Rome, at which point Octavian sprung back in action at the head of a large army of supporters, caused Leo VII to flee in fear for his life, and after taking Rome back in February 964 held a synod that declared the one that had deposed him as uncanonical. He mutilated some of his enemies in the city to reassert his influence and sent a bishop as an envoy to Otto, but before anything could come out of it, he died. The usual Liudprand stated this happened while he was committing adultery: some said the cause of death was apoplexy, others, an angry husband. Octavian would've been 27 at the youngest and 34 at the oldest.