I've heard that there was some debate during the war of independence about how to name the new nation, and that the two most popular options where Anahuac and Mexico
What strikes me is that both names are nahuatl words, but few leaders of the movement were natives, and those who were spoke other native languages and not nahuatl
So, why where those the most popular options? And why the Mexico end up winning?
Spanish as a preponderant language in Mexico is a very modern thing, the reality of colonial rule is that Spain, or more exactly the Kingdom of New Spain had very little control of the territory outside of mayor cities or fortified enclaves, as a result, throughout the colonial period very little effort was made to homogenize the languages spoken to the point that according to Nicholas Ostler's Empires of the Word: A Language History of the World by the end of the Mexican War of Independence only around 45% of the population were of "mestizo" decent and spoke Spanish (and many of them probably didn't do so as a first language).
In fact when father Miguel Hidalgo y Costilla first began the war for independence his own memories make note of the fact that most of the people accompanying him in the early stages of the war, for example, in the assault to the Alhondiga de Granaditas were mostly nahuatl speaking.
Humbolt himself when calculating New Spain's population in 1793 calculates: "per every 100 individuals 18 are spanish, 60 indigenous and 22 from other mixed generations.", "indigenous" in this case being clearly separated from mestizos and other spanish-speaking populations so, not exactly a low number.
And this is in the center of the country, in other more faraway places like modern Texas or New Mexico people often just defaulted to local languages:
To contemporary Euro-Americans the most illuminating sign of Comanches’ cultural power was the spread of their language across the Southwest and the Great Plains. By the turn of the eighteenth century, Comanches were able to conduct most of their business at New Mexico’s border fairs in their own language, and many of the comancheros and ciboleros who visited Comanchería to trade and hunt were fluent in the Comanche language. The diffusion of the Comanche language accelerated in the early nineteenth century when Comanches extended their commercial reach across the midcontinent, connecting with a growing number of people. Hämäläinen, Pekka. The Comanche Empire (The Lamar Series in Western History) (p. 171). Yale University Press
Now, as for the name of "Mexico", I wrote a little bit about it, but u/drylaw greatly expanded the comment in here and I highly recommend you check it out, but the tl;dr version is: The city of Mexico-Tenochtitlan, had become a prominent metropoli and as such the region was often associated as "Mexico" and its inhabitants as "mexicans".
Now, "America Septentrional" was also often used to refer to the region as a whole (though in my humble opinion "United States of the Septentrional America" is just a mouthful), with several documents actually making reference to this like for example 1813's "Solemn Declaration of the Independence of Septentrional America".
"Anahuac" in principle wasn't the name of the country, it was the name of the continent in nahuatl and of the Congress who declared independence from Spain (much like saying the Continental Congress during the US War of Independence), Mexican nationalism has always associated itself with its past, for example in 1814 Morelos mentions the fall of Tenochtitlan as the beginning of Spanish oppression in his opening speech to the Congress of Chilpancingo:
... And from the 12 of August of 1521 went on to become 14 of September of 1813; in that moment the chains of servitude were tied in Mexico-Tenochtitlan; these are broken forever by the brave people of Chilpancingo.
Even in its early stages it often referred to the Mexican nation, for example when writing the Constitutional Decree they include sections like:
“the conquered sovereignity will be an inmutable principle from which mexicans will never again be denied of."
By 1814, when the Apatzingan Constitution is published, its legislators already refer to the inhabitants of the nation as [mexicans] (https://memoriapoliticademexico.org/Textos/1Independencia/1814-DipProvMex.html) as does the body of the Constitution itself with the legislative body being named the "Supremo Congreso Mexicano" (Supreme Mexican Congress).