To understand how exactly ayurvedic medicines work we need to know a bit of human body science as per our old scholars.
Sushruta rishi has done the maximum effort in this i.e Anatomy of human body.
The whole science of Ayurveda is based upon the fact that our body is made up of three main doshas n seven dhatus (Doshas and Dhatus).
Three doshas (दोष) are
Seven dhatus (धातु) are
All diseases occur due to permutation n combination of above doshas and dhatus. Accordinly treatment in Ayurveda is also based upon the fact that which dosha or dhatu is increased or decreased.
The goal is creating a balance among athe above doshas and dhatus.
सम दोष सम धातु सम अग्नि मल श च।
Drugs used in treating the imblances are chosen depending upon the qualities they have (गुण धर्मं) so that they maintain balance among all doshas n dhatus.