Food is fuel for your body so you want to be sure you are giving it what it needs to optimize your workout and your overall health. Without enough quality fuel, your metabolism gets the message it needs to slow down to preserve what calories you do have left in your body (storing all and any fat), or if all of your glycogen stores are depleted, your body may try to eat away at your muscles when it runs on empty. This can be bad for your blood sugar, your muscles and ruin your performance.
Fueling for (and recovering from) exercise matters most when you are performing a longer and more intense workout. No matter what you are doing, though, you want to make sure to eat any small snacks at least 20 - 30 minutes pre-workout, which leaves time for digestion. Keep any bigger meals to at least two hours before your workout.
Before Your Workout: If you are eating an hour or two before a workout, make sure to eat a small amount of something easily digestible. Try to stay away from anything with too much fiber as it takes a long time to digest and may cause stomach upset. Carbs are important and depending on your workout you may want to add in some protein to stave off hunger as well. Some examples; half a banana, some greek yogurt, half of a fruit and nut bar like a Larabar, or almond butter on a piece of whole grain toast.
After Your Workout: Again, it depends on how long you exercised and what you did as to what to eat when you are done. If your workout is under an hour and not especially intense, no post workout snack or meal is necessary. I know when I plan to run for 30 or 40 minutes, I love to run mid morning right in between breakfast and lunch, no special snacking required. If you had a more lengthy workout and/or did any strength training, be sure to eat a little something with carbs and protein after. Some examples, cottage cheese and peaches, Triscuits and cheese, almond or natural peanut butter on whole grain bread, or a handful of almonds and fruit. Just don't overdo it!
Experiment with your pre and post workout meals and snacks. Find what works best for you!