The term treasury comes from the Latin "aerarium" which means "public treasure". The treasury was and continues to be all the assets that the State has, as well as the place where they are kept. State income basically comes from the collection of taxes, however it can also be derived from the collection of import duties or other activities.
In Roman civilization the "aerarium" was the public treasure, which was obtained through the taxes collected. Its headquarters was located on the Capitol Hill, specifically in the Temple of Saturn. As has already been said, the treasury is constituted in its majority, by taxes or other tributes received by the republic. At first these taxes had to be canceled by all Roman citizens; however, these were exempted from payment, due to the triumphs of the Roman generals in the Hellenistic nations.
The taxes that nurtured the treasury were diverse, one of them was the one that Rome received from the towns dominated by her, these taxes represented a type of compensation for allowing them to cultivate in these lands assigned by them, for the community. Other taxes were associated with the sale of products. Others were applied in different legal acts, such as the value of slaves, the value of an inheritance, among others.
Certain scholars of the time considered that the treasury was created as an administrative method to streamline everything related to inheritances, especially in cases where a subject died without leaving a will and without having relatives to claim said inheritance, so before this situation, the money remained in the hands of the State.
In general, the treasury of a country is used to finance public works for the community. The officials in charge of its administration must be responsible and honest, they must also know what the needs of the population are in terms of infrastructure, roads, health, education, etc. and starting from there distribute the money in a responsible way.
There are many countries that collect large amounts of money, which go to the public treasury, however it can be seen how the population is not favored with this, which could mean that the misnamed "little worm" of corruption is doing theirs, which is completely regrettable, since such a country will never prosper.