expression
thank you for the meal; that was delicious
Polite expression used after eating to thank the person who prepared or paid for the meal. Also said when leaving a restaurant. The past tense でした is standard, though ごちそうさま (present) is used casually.
「ごちそうさまでした」と言って席を立った。
I said 'thank you for the meal' and left the table.
今日の晩ごはん、本当にごちそうさまでした。
Thank you so much for tonight's dinner; it was truly delicious.
From ご (honorific prefix) + 馳走 (ちそう, 'running about', referring to the effort of preparing a meal) + 様 (さま, honorific suffix) + でした (polite past copula). The phrase literally acknowledges the effort put into the meal.