Molecules are a group of atoms bonded together, representing the smallest fundamental unit of a chemical compound that can take part in a chemical reaction.
The only difference between a molecule of a compound and a molecule of an element is that in a molecule of an element, all the atoms are the same. For example, in a molecule of water (a compound), there is one oxygen atom and two hydrogen atoms. But in a molecule of oxygen (an element), both of the atoms are oxygen.