A compound sentence is made up of two or more Principal or Main clausesExample: I went because I was invited.
Here, both parts of the sentence(I went.I was invited.)can stand independently and each of them makes good sense.They are called 'Main Clauses'.
A complex sentence has one main clause and one or more subordinate clauses.
Example: Tell me the news as you have heard.
Here 'tell me the news' is the main clause as it stands independently and makes sense. But 'as you have heard' cannot stand independently.Therefore it is a subordinate clause.