A very common Christian practice is to "say grace" or to "give thanks" before each meal. What is the Biblical precedent or command for this? In other words, why do we give thanks then and not before going to bed or going to work or any other common occurrence?
There is definitely precedent: As Christians, we should be following the example set by Christ, who gave thanks before feeding the multitudes in Matthew 14:19-21 and Matthew 15:34-36. He also did so in Luke 24:30.
Paul also did so in Acts 27:35.
I could go on, citing verses that tell us to be thankful in all things, to pray without ceasing, but those would be weaker, and not specific to your question, so I'll stop with these three examples as Biblical precedent.
There is a command in Deuteronomy about giving thanks after the meal:
There is one thing very important that we should always consider: we own nothing, all is for the Creator. If today we have such opportunity to have something good or bad, meal, job, incident, it is per God grace, why not just say: "thank you God", He knows why, and it is not by our own strength, do not be deceived.
Grace before meals is a Jewish tradition that was in some respects followed by Jesus and also Paul, but is not technically 'commanded' in a legal sense from scripture.
As far as the overall origin of 'grace before meals' I would say it was established in all the ancient sacrifices which included eating portions of the sacrifice. Very early under the Levitical ceremonies food was associated with religious significance. It is no wonder then that a tradition around food has always accompanied various forms of Judaism and Christianity.
According to the rabbinic tradition found in Berakhot, Mishnah-, Tosefta-, Talmud tractate Benedictions:
One can witness Christ followed this Jewish custom (he followed many of them) in the miraculous feedings. (See Matthew 15:36). This does not mean that he or his disciples fastidiously had grace 'before every meal'. The Pharisees who did every thing with 'caution' and a reverence to the 'external', attacked Jesus' disciples on one occasion for eating without even washing their hands so it would not be improbable that they also neglected whatever prayers might have been expected upon them.
Alfred Edersheim the Jewish historian actually confidently affirms that most likely Christ's prayer would have been the typical 'thanksgiving':
It should be noted that the context of scriptures reference to Christ's observance is a large formally religious gathering in a prayerful need that is about to be miraculously answered. Hardly can this be translated into a legalistic rule mandating prayers of thanks before eating Chicken McNuggets on the run. However there are a few scarce stands of scripture in the Epistles that keep up with this theme, although somewhat always on the circumference of other subjects. First in Acts when Paul is on the stormy ship 'he took bread, and giving thanks to God in the presence of all he broke it and began to eat.' (Acts 27:34). Note that this occasion was also a formally religious one with calls of help and salvation.
See also 1 Corinthians 10:30-31.
However here is what we should really conclude (in my own mind). Paul's main use of 'thanksgiving' was in how he opened many of his letters with prayers. It was a way of life and although it also extended to formal religious meals, meals are not set aside as more special than the thanksgiving for all the good things we receive. The idea that any family who sits down at a table to eat without a prayer of thanksgiving is somehow inferior to one that does, is more of an interpretive cultural notion not directly established in scripture. In fact beyond the few references that I have mentioned little in the entire Bible would suggest 'grace' before meals as expected behavior for all Christians. The silence of the Bible on the subject is a strong argument against its legalization.
In the Old Testament 'thanksgiving' was most formally identified with singing and in the 'thanksgiving' sacrifice. In the New Testament it is sincerely giving our lives to God, in totality and in love to God and our neighbor. This high and extreme thanksgiving must toss aside all other forms as inconsequential especially those having to do with 'food and drink'. If I was to personally become legalistic in my thinking about 'grace', I would probably insist that public prayers be offered in the 'harvest in gathering' during our monthly salary banking transactions. Falling onto one knee in our cubicle when sighting our payroll deposit, which comes from God to buy our food and so much more, would be more in-line with Mosaic Law than saying a few words before a meal.
Having said this prayer and thanksgiving is a very good thing, so neither should we judge anyone who feels a duty to formally receive all food in a prayer (whether snacks and drinks are included in this 'duty' I leave it to those who concern themselves over it). In either case, whether offering prayers outwardly, or just being happy inwardly, in God's presence, in all occasions, we should receive in thanksgiving all that we receive, including gratitude for all those blessings contained in brothers and sisters in Christ, that may have their own view about these things.