Well, the flag has changed alot of times, as the design of the coat of arms and the length-width ratios of the flag have been modified... The coat of arms is derived from an Aztec legend, that their gods told them to build a city where they spot an eagle on a nopal eating a serpent, which is now Mexico City.
If you need more info let me know