This is a very interesting question, even somewhat mind boggling.
You’ve heard of mitochondria, right? Organelles in embedded in the cells of macro-organisms, such as ourselves, and that carry their own trimmed down genetic code in DNA? Well their is another organelle in cells that has DNA separate from that of the macro-organism. That is the chloroplast, which is what constitutes the green coloration in plant tissue and is where photosynthesis is done in the plant. Chloroplasts have DNA also.
Now, how is that you may well ask. Why would mitochondria and chloroplasts have their own DNA separate from that of the organism that otherwise completely surrounds and sustains them?
Scientists are pretty convinced by now that it is because both mitochondria and chloroplasts used to be free living organisms on their own. At some point in the early history of life, they became symbiotic and then dependent on unicellular host organisms. The dependence, however, was reciprocated, as neither humans nor plants (with significant exceptions) can live without chloroplasts.
So the main adaptation of plants to do photosynthesis has been to incorporate chloroplasts into their own cells and then further adapt their inputs of water and nutrients to take advantage of that.