In my case, the local utility requires the electrical meter to be accessible (obviously) and to be a certain distance from the gas meter (obviously). Because of the way my house is shaped, there simply isn't room to move the electrical meter, so a sub-panel was the simplest option. Anything else would involve tearing open the driveway, which would be worse. It really depends on the situation.
It'll give you a really good introduction to house electrical systems, things like "any panel that is connected directly to the utility is the main panel, any panel that is connected to a panel with a shutoff is a sub panel".
https://www.amazon.com/Uglys-Electrical-References-Charles-M...
https://catalog.nfpa.org/NFPA-70-National-Electrical-Code-NE...