Sodium is a soft, silvery metal that reacts violently with water, and chlorine is a poisonous yellow-green gas. Let them react and you get white crystals of sodium chloride, table salt, which you sprinkle on food. Every sodium atom has bonded with a chlorine atom, 1 to 1, and the result behaves like neither of them. A new substance with new properties has formed, and that is a compound.
Two features mark a compound. First, more than one element is chemically bonded, so the formula has two or more different symbols: H2O, NaCl, CO2. Second, the ratio is fixed. Water from a glacier, a tap or a laboratory is always 2 hydrogen atoms to 1 oxygen atom. Change the ratio and you get a different compound: H2O2, hydrogen peroxide, is a bleach, not something to drink.
A mixture can contain the same elements without being a compound. Air holds nitrogen and oxygen, but they are not bonded to each other, the proportions can vary (a hospital oxygen tank holds far more oxygen than room air), and they can be separated by cooling air until it turns liquid and then letting each gas boil off at its own temperature. If the parts keep their own properties and can be separated physically, it is a mixture; if they are bonded in a set ratio with new properties, it is a compound.
Think of it like this. A compound is a bit like a baked cake: flour, eggs and sugar go in, and what comes out tastes and behaves like none of them. A bowl of trail mix, where every piece stays itself, is the mixture. The cake comparison has two limits: a compound's recipe can never vary, and chemistry can split a compound back into its elements, which no baker can do with a cake.
Core idea. When different elements bond, they form a new substance with a fixed ratio of atoms and properties of its own, and it can be separated into its elements only by a chemical reaction.