A compound is a pure substance composed of two or more different atoms chemically bonded to one another. A compound can be destroyed by chemical means. It might be broken down into simpler compounds, into its elements or a combination of the two.
So if a substance is given, if we want to know if it is an element or a compound, if the substance is bonded by two or more atoms then it is a compound. If it is of a single atom or same atoms then it is an element.
eg: O2 is an element where as CO2 is a compound.