I think it is just chemistry. Some types of ingredients need to penetrate other ingredients, or break then down to release their flavors, or alter them in some other way, like with brining a turkey or marinating meat for BBQ. Some of it is just time. Some ingredients need time to fully mingle and get spread throughout a dish. This seems to be especially true with dairy based dips such as onion dip or raita, or tzaziki sauce. With other dishes, it’s the heat applied over a long period of time that changes the way the dish started, to the way it ends up, like with chili or spaghetti sauce. Sometimes it’s the change of temperature, plus time, for example pasta salad, which usually tastes better the next day, but is not quite as flavorful immediately after it is prepared.
Read through some recipes of things that you like to make, and you will learn by reading the recipes which types of dishes need time and which ones do not.
Here is some interesting information about Brines and Marinades for BBQ
Here are some things that taste better The Next Day
On the other hand, some dishes need to be eaten almost immediately, lest they become soggy. Regular old green salad with a vinaigrette dressing comes to mind.
Then there are other dishes which taste fantastic when eaten right away, but then become something entirely different, and differently delicious the next day, when eaten cold. Fried chicken and pizza are two of these things.
I have noticed something odd too. Good old Kraft macaroni and cheese, the stuff from the blue box tastes fantastic, when it’s hot off the stove, but most of the flavor disappears and seems to actually change quite dramatically when you refrigerate it and reheat it the next day. On the other hand, homemade macaroni and cheese, that you bake in the oven is just as good, reheated the next day.
Here is a very good Explanation based on the actual science of food ingredients. Enjoy!