As main() method is needed to run the Java program and while writing tests in TestNg we don't use main() method,we use Annotations instead.
Annotations in TestNG are lines of code that can control how the method below them will be executed. So, in short you don't need to write main() method, TestNg do that by itself.
You can refer code at the end in Annotations documentation to get the idea how it happens.
Hope it is helpfull!!