The claim is broadly true, but with one or two caveats. First, some context. It was actually very common for Mesoamerican lords to keep large gardens. The lords of the Triple Alliance (Mexica, Acolhua, and Tepeneca) all controlled multiple garden, zoos, and hunting reserves. Not all of these gardens would qualify as botanical though. Most had mixed functions, including pleasure, as well as serving as a site of worship and devotion. However, some were used for their botany. The most famous of these, and the one you are probably thinking about, would be Huaxtepec. Huaxtepec displays several characteristics that mark it as a botanical garden: use in research (medical and botanical), as well as an imperial prestige project.
The most accessible source on this would be Durán. According to his historia, the creation of Huaxtepec was the brainchild of the Mexica official Tlacaelel. To quote: ‘Let us send to Cuetlaxtla, where Pinotl governs in your name, and order him to send the following plants to us: cacao trees, xochinacaztli, volloxchitl, cacaoxochitl, izquixochitl, huacalxochitl, cacalxochitl, and other flowers that grow in the Hot Country nears the coast, and see if they will thrive here in Huaxtepec.’ The following passages describe the creation of the garden. Tezozomoc, a Nahua writer, provides a very similar description, but includes even more plant varieties in his account. Keep in mind that this occurred in several other places as well, Huaxtepec was just the most prominent. Together these accounts establish that the Aztecs were indeed interested in testing plants to see the different kinds of environments the trees would grow in. Additionally, the creation of these gardens was connected to the growth of the empire. According to Matthew Restall, this collection practice was not incidental, but a fundamental aspect of elite strategy which extended beyond plants and into animals. Triple Alliance lords would grow plants and keep animals to show their ability to manage, connect with, and rule, the natural forces of the world. What they couldn’t physically keep in gardens, they had replicated in precious metals. The idea was to try and show that the natural forces were being unified under Mexica command, and therefore that the Mexica could intercede using these forces to ensure stability and prosperity on earth.
For the medical function of the gardens we must turn to Francisco Hernández. Hernández was a royal physician in the Castilian court who was sent by the king of Spain to Huaxtepec to study Aztec medicine and plant knowledge. His texts contain over five hundred different entries for herb-based treatments, and just as many, if not more, individual plants. This established that these gardens were indeed used to grow medical herbs. Furthermore, Bernard R. Ortiz de Montellano has argued that, in most cases, the Aztecs were absolutely right about the effects of these plants on the human body. This does not mean that Aztec cures were necessarily effective (although many were), just that they knew how taking certain medicines would affect a person’s body. We have several other texts that reveal Aztec botanical and medical knowledge, including Book 7 of the Florentine Codex, and the Codex Barberini. In particular, the Codex Barberini seems to indicate that the Aztecs had a well-developed classification system for medical plants. Lastly, Aztec doctors were considered to be better than their Spanish equivalents, which would be proof of the efficacy of Indigenous medicine.
However, these are not the earliest accounts. Cortés also mentions the gardens, as does Bernal Díaz, although both only do so briefly. They also seem unaware of its character as a botanical garden, instead describing it as an ‘orchard.’ Nevertheless, their accounts contain much better descriptions of other gardens and zoos, which can be used to infer what Mexica/Aztec gardens were like. Their descriptions of zoos for example, indicate that the Mexica took steps to replicate natural habitats, including creating artificial pools for water birds. They also kept veterinarians on staff to care for the animals, suggesting that this was a specific discipline. In other words, their zoos looked a lot like modern-day zoos.
From this we can conclude that the Triple Alliance had botanical gardens which were used to grow and study plants for their medical uses, as well as to buttress the perceived prowess of the Empire. In addition, the Aztecs had a huge body of botanical, agricultural, environmental, and zoological knowledge that they deployed in the creation of gardens and zoos. However, there is one big caveat. Although the Aztecs may have been able to the scientific method to experiment with plants, their world view was ultimately religious, and their understanding of their results was filtered through their spiritual beliefs. Consequently, their conclusions would, even is practically effective, would lack scientific accuracy. This may not have been a bad thing, however. Instruments did not really exist for their investigations to be carried further, and their spiritual interpretation may have allowed Aztec doctors to develop more holistic treatments to compensate.
References: Bernard R. Ortiz de Montellano, Aztec Medicine, Health, and Nutrition, (New Brunswick and London: Rutgers University Press, 1990) Bernardino de Sahagún, General History of the things of New Spain Book 11: Earthly Things, tr. by Arthur O.J. Anderson O.J., and Charles E. Dibble, (Santa Fe: University of Utah, 1979) Bernal Díaz, The Conquest of New Spain, tr. J.M. Cohen, (London: Penguin Books, 1963) Diego Durán, History of the Indies of New Spain, tr. Doris Heyden, (Norman: University of Oklahoma Press, 1994) Francisco Hernández, Historia de las Plantas de Nueva España, Tomo 1-3, [History of the Plants of New Spain, Volume 1], (México D.F.: Imprenta Universitaria, 1942) Hernan Cortés, Letters from Mexico, tr. Anthony Pagden, (New Haven: Yale University Press, 1986) Hernando Alvardo Tezozomoc, Cronica Mexicana, (2nd edn., Mexico: Editorial Porrua S.A., 1975) Matthew Restall, When Montezuma met Cortés: The True Story of the Meeting that Changed History, (New York: Ecco: An imprint of HarperCollins Publishers, 2018) Susan Toby Evans, ‘Aztec Royal Pleasure Parks: Conspicuous Consumption and Elite Status Rivalry’, Studies in the History of Gardens and Designed Landscapes, 20 (2000) William Gates, An Aztec Herbal: The Classic Codex of 1552, (New York: Dover Publishing, INC., 2000)