Throughout the book, Stephenson covers Loeb's entire history. I don't remember the exact points where all of these are covered, but it is said Andrew's childhood and adolescence saw him involved in a terrible family relationship, bitter divorce and even an abduction. His parents fight over him like he is property and using him as a weapon to hurt one another.
Pixel covers Andrew's college activities. Randy and Andy meet when Andy requests some books from the inter-library loan program where Randy works. Andy is researching Native American tribes by examining their diet, calorie intake, and energy expenditures for daily activities, which piques Randy's nerd sensibilities. Their relationship is fairly amicable at this point, as they have frequent discussions including a survivalist expedition into the mountains. Only when Randy broaches the idea of using Andy's research in a video game (technically, a computer aided RPG software package) does their relationship spiral into animosity. In short, Andy believes his research to be the more valuable contribution, underselling all the data entry, number crunching and programming that Randy did to create working, usable software. Convinced that the software will never be commercially successful, Randy abandons the effort to publish it at all.
Later, Andy's instability is shown to continue growing, as Randy explores the expansive online presence where Andrew refers to himself as RIST (Relatively Independent Sub-Totality) 9E03 (TVTropes Warning). This is reminiscent of some early-web crazy people, like the Time Cube guy, where the only thing scarier than someone with enough free time to post such a thing is someone with that much spare time who is serious about what they say.
Finally, there is a long exchange between Randall and Avi, while they are walking on the beach outside Avi's home, just before the raid on Novus Ordo Seclorum. In this dialog, they cover Andy's his recent professional career developments into an attorney. In a twist, Avi reveals that
Andrew is working for the lawful-evil business partner Hubert Kepler and is part of the legal team suing Randy and Avi's Epiphyte II corporation. Randy expounds that this is a perfect profession for Andy, because Andy's childhood would leave him to believe that a rich, overbearing minority shareholder could actually be materially harmed by making slightly less money from one of their investments, when actually this is a common power-grab litigation technique.
They make it pretty clear that Loeb has come to hate Randall, his world of technology, and his company. Randall compares him to Gollum (continuing the LOTR riff where Randy compares himself to a Dwarf, his Grandfather Lawrence to a Wizard, and his estranged girlfriend and her friends in Academia to Hobbits). It is a weak comparison, in my opinion, as technology that Loeb hates isn't a reasonable facsimile for the One-Ring, corrupting him over time; Andrew is childhood-trauma crazy (and not because he murdered his best friend over a video game). However,
Stephenson's foreshadowing is apt, because like Gollum, Andrew reappears during the climax as the final serious threat to the protagonists, stalking through the jungle, losing a leg to a land mine, and then shooting Amy with an authentically hand-made reproduction of a Cayuse arrow, learned from his aforementioned extreme survivalist activities.
Randy theorizes that Andy is full enough of hatred to want to injure him and his loved ones in any way possible. Whether or not craziness and hatred is enough of a motive for Andrew Loeb is up to the reader to decide. But I agree that, as an antagonist, Andrew isn't the deepest of characters. We don't see any of Andrew's side of the story. Come to think of it, I don't remember there being any scenes of dialog with Andy at all.