He usurped control of the Matrix from the Architect, and updated the Matrix to better control the humans within it (purging many Programs in the process). He then posed as Neo's therapist to keep access to him.
The Analyst was created to understand human psychology in order to control them better - in some ways, making him a new attempt by the Architect to replicate the original role of the Oracle. However, while the Oracle's better understanding of humanity led her to side with them, the Analyst did the opposite: he came to see the Architect's mathematical control of humanity to be incompetent. The Analyst later said derisively that the Matrix as designed by the Architect was "all fussy facts and equations" because he loved precision, and hated the human mind. Instead of trying to control humans' propensity for belief and self-delusion, the Analyst decided to work with it. According to the Analyst, the Architect never realized that humans don't care about facts, but rather about fiction: all that matters is the world within their own mind, and humans generally believe what they want to believe.
The Analyst was present when Neo sacrificed himself in the Machine City to stop Smith, and was tasked with analyzing Neo's body to try to better understand the code Anomaly that he embodied and which granted him reality-warping powers within the Matrix. The Machines never created the Anomaly, they merely redirected it in each Matrix cycle, but even they did not perfectly understand it. The Analyst soon discovered that Neo's powers as "the One" were linked to Trinity, that the Anomaly was activated by the bond between them. Therefore he recovered Trinity's corpse as well, then convinced his superiors to expend considerable energy and effort into repairing and resurrecting them, to further his research. While the Analyst never fully understood the Anomaly, he gained much more knowledge about it, and realized that through Neo's low-level link to all of the other humans plugged into the simulation, he could actually increase energy output in the entire Matrix when Neo's bond to Trinity was strained, but not entirely severed - keeping them tantalizingly close but in anguish.
The Analyst became increasingly disillusioned with the Architect's mathematical precision over the years, concluding from his research that "feelings are easier to manipulate than facts", which culminated (about twenty years after the Battle of Zion) when he seized power from the Architect himself. He then radically redesigned the Matrix, now feeding the human capacity for self-delusion, i.e. updating the internal setting from around 1999 to around 2020, imitating the social media, iPhones, and corporate-produced entertainment franchises of the original early 21st century - in effect, re-creating the complacent human society that allowed the Second Renaissance to happen in the first place. While there was some risk that this updated Matrix setting gave people a better understanding of the risks posed by early Artificial Intelligence, the Analyst again smoothed this over by feeding them pop culture entertainment franchises based on "The Matrix" as a video game within the simulation.
When the Analyst rebooted the Matrix to his new version, he also instituted a purge that wiped out many Programs, both independent ones and those serving the old administration. The Architect, Oracle and Sati's parents were all deleted, as well as most of the Exiles (though a handful survived). The Analyst's new Matrix also replaced Agents with Bots, individually less-powerful programs but camouflaged as humans and saturated everywhere.
Around the same time, in the real world, this coincided with a Machine Civil War, as power plants stopped producing as much electricity and factions started forming between different Machine cities (and some even switched to the free humans' side). Whether the Analyst's coup caused this energy crisis or whether his coup was a reaction to it is unclear.
The Analyst does mention that he is not, strictly speaking, the leader of his faction - he is the new ruler of the Matrix, much as the Architect was (who he calls his "predecessor"), but even the Architect wasn't exactly the leader of the entire Machine civilization in the real world. The Analyst vaguely mentions having superiors - who he flippantly calls "the suits" or "the authorities" - and that he had to convince them to continue his gambit with Neo in the Matrix. Given that the Analyst's new Matrix generates much more power than before, however, and the Machines were beginning to war between themselves due to an energy shortage, he holds considerable leverage with the Machine leadership in the real world (for example, convincing at least his own faction to accept his overthrow of the Architect).
Unlike the stiff and mathematical Architect, the Analyst is somewhat of a dark counterpart to the Oracle. Both were Programs designed to better understand human psychology, and thus both have somewhat playful personalities, cracking jokes and manipulating others. While the Oracle was generally benevolent and tried to guide other people, however, the Analyst is darkly manipulative, and gleefully taunts his enemies.
The Analyst is egotistical and cocky: he derisively refers to humans as sheep who do what they're told, and who fundamentally want to be controlled by the Matrix - but he genuinely believes this, and within that framework wants to make the Matrix as pleasing of a fantasy as possible. While the Architect saw himself as taming unruly humans against their will, the Analyst in his own way feels he's just giving humanity the self-delusions it's always wanted. While he is not completely sadistic and at times displays genuine honesty, when it suits his own interests he is fully willing to outright lie to his enemies and break his promises - which is considered very shocking behavior for a Program (comparatively, the Architect was blunt and unyielding, but he was always honest and true to his word).