There is masses of information out there which tells you that the way you swim is closely linked to what you eat - in other words, the more healthy your diet, the better you are going to swim!
There are plenty of food choices that will work for a swimmer before a training session or a swim meet but the basic facts are that in order to train hard and swim fast, you need to eat a balanced diet consisting of
about 50-60% carbohydrates (e.g. pasta, potatoes, cereals, bread etc.)
about 10-15% protein (meat, fish, eggs etc.) and
about 25-30% fat (try not to eat too much dairy)
Don't forget about drinking too... you need to remember to rehydrate before, during and after training. Bring a drink bottle to the poolside and drink between sets. Try to avoid fizzy drinks and as a rule you should be drinking about 6-8 glasses of water per day.
Eat a minimum of five portions of fruit and/or vegetables a day and eat at regular meal times. Carbohydrates are the most efficient source of energy and you are looking to gain that energy to allow you to swim at your best so plan your meals carefully. A heavy pasta meal just before you swim will just make you feel sluggish.
This is especially true if you are at an open meet and away from home for the day or weekend. Make sure you eat! Yes, that sounds obvious but if you are nervous or excited, it is easy not to feel like eating but this could be costly in terms of your performance. Your energy levels will not sustain you through the day so by the time you get to race, you will not have to energy to perform at your best.
Make sure you eat breakfast and lunch but don't overeat - it is much better to snack during the day between races. Snack on things like bananas and nuts (much better than chocolate!).
Take a look at the British Swimming website for more information and tips.