As far as I understand it now, there were originally the two words יֶ֫רֶק, which meant greenery, vegetation or herbiage, and יָרָק, which meant vegetable or greens. Both are biblically attested. As both words have the same plural יְרָקִים and you mostly speak of vegetables in the plural, people began to confuse the two words and started using יֶ֫רֶק as the singular for vegetable and this stuck.
Said the child to the man running the vegetable stand in which there was tomatos for sale.
Well, to express this is or that is, i.e. the independent demonstrative pronoun, Hebrew does not have two different sets like English for distal and proximal things. But if you want to modify a noun, then you can say הַתַּפּוּחַ הַהוּא that apple in higher registers of language.