I guess there are two parts to the answer- why is green a good colour for plants to be, and how do they go about it. The key to the first part lies in how plants go about the business of living- they use light energy from the sun to drive the process of photosynthesis, which converts carbon dioxide into the sugars that they need to survive.
The fact that the leaves are green is because they are reflecting green light, and absorbing the other colours in the visible spectrum. When the light is absorbed, it is absorbed by the atoms that make up the leaves. These atoms, stuck together in molecules, gain energy from the light and this is needed to run photosynthesis. The reason plants decide to use visible light as opposed to infra-red or ultra-violet light is the same reason as why we see in the visible- there’s plenty of it around to use!
Now to the second part- how do they make themselves green? This is due to the very clever design of the molecules found in the leaves. There are several parts that make up the leaf, but the main two we’re thinking about is the bit that captures the light and the bit that carries out the photosynthesis reaction. It is possible to remove and capture the bit that captures the light, and analysis shows that it belongs to a family of molecules called porphyrins. Their structure is such that they can jiggle at frequencies that match the frequencies of some colours of visible light, meaning that they can absorb the light energy for use by the other parts of the leaf.