Why does plant life precede the Sun in the order of creation given that plants need the Sun to do photosynthesis?
First, it may not be valid to assume that creation was bound by the laws of science as we now understand them. Why should we assume that the very first plants grew by photosynthesis in the same way that plants do now? Or if we do, why not assume that the primordial light created on the first day was enough to produce this effect?
But setting all that aside, Bereishit 2:5 presents us with a related question:
It's not clear when this text refers to; it falls after vay'chulu and and before the (second) creation of Adam. This verse seems to say that plants depended on man being available to work the soil. But chapter 1 says we got plants on day 3, so how do we resolve this? Rashi offers the following interpretation:
According to Rashi, when God created the plants, trees, and grasses on day three, they didn't actually start growing -- they were, essentially, "queued up" underground, waiting for rain, which in turn waited for a man to recognize the need for rain and pray for it.
With Rashi's interpretation, the sun, moon, and stars were well-established before the need for photosynthesis arose.