Well, basically, why not? While years are a clear astronomical phenomenon---the Earth goes around the Sun, the seasons complete a full cycle---months are more or less arbitrary. They are sometimes based on the revolution of the Moon, but that doesn't fit evenly into a year, so most calendars make some sort of adjustment, including the Gregorian calendar we use where most months are 30 or 31 days even though the Moon's orbit is about 29 days long (as seen from Earth).
Most Mesoamerican cultures use a form of the Mayan calendar, because the Mayan calendar is astonishingly accurate---we're still not entirely sure how they gathered enough astronomical knowledge to make it line up so precisely with the orbital precession of the Earth. (Their leap year adjustments are actually slightly better than the Gregorian calendar, albeit more complicated to work with.) There are a lot of crazy theories out there ("Aliens!"), but the most plausible one is simply that this was very important to them based on their religious beliefs, so they took extremely careful measurements with the equipment they had.
What we do know is that they had an advanced mathematical system, including the use of zero and modular arithmetic, which cultures in Europe and Asia would not figure out until centuries later. They also used base 20 most of the time, so months had 20 days (numbered 0 to 19, just like base-20 modular arithmetic!); this made for 18 months, plus 5 or 6 extra days called "Uayeb" that were observed as solemn holidays.