Mexico in its original sense is the homeland of the Mexica (Aztec) people and its principal city. The sense of the name broadened, presumably as people in the metropole spoke broadly about it, and then contracted as marginal regions left its orbit.
New Mexico is an administrative region established in 1581 with a name implying apartness from Mexico. For two centuries it was part of the Viceroyalty of New Spain, often informally called "Mexico" after its capital city. Upon independence in 1821, the part name became the whole and New Mexicans found themselves living within their homeland's own namesake.
At independence, did the New Mexicans -- people in the society called New Mexico -- already regard themselves as Mexican, or did they have to get used to the idea?