Remember, the very end of the story (the last three paragraphs) returns to where it started - with Gene looking back at his Devon experience after fifteen years away from the school. From the distance of time and with the help of maturity, Gene recognizes that the greatest enemy he fought during his time at Devon was himself.
The insecurity that caused jealousy, the need for recognition that caused Gene to misinterpret the actions of others, the lack of confidence that resulted in actions later regretted and repressed - those facets of his own personality were Gene's enemy. Gene fought his enemy as he fought to come to terms with himself, with what he had done at the tree and why, and with how to live without the fear of those days. At the end of the book, Gene realizes that
only Phineas never was afraid, only Phineas never hated anyone. Other people experienced this fearful shock somewhere, this sighting of the enemy, and so began an obsessive labor of defense
Gene's enemy had been within himself; he defeated it as he came to accept himself, who he was, and how he lived his life.