Gellert studied at Durmstrang. He was an extremely gifted student. He was expelled from the school at the age of sixteen due to dark experiments on fellow students, even though the school is known for its tolerance regarding the Dark Arts.
Later, in a letter to Grindelwald, Albus said that using force beyond what was necessary when facing resistance had been Gellert's mistake at Durmstrang—a mistake that, according to Dumbledore, the two wizards would not make when building their new world order (DH18).
After his expulsion from Durmstrang, Gellert went to Godric's Hollow and spent some time with his great-aunt Bathilda Bagshot. Bagshot was neighbour to the Dumbledores, and Gellert quickly befriended Albus, who had recently come home due to his mother Kendra's death, in order to take care of unstable Ariana Dumbledore.
The two teenagers were brilliant, and became close during the following summer; in particular, their interest in the Deathly Hallows bound them, and they planned to overrule the Statute of Secrecy and found a brand new world order, with wizards ruling over Muggles, as was their birthright. Albus made a point of stressing that this would be done for the greater good: wizard rule would improve the overall condition of the world (DH18, DH35).