A compound sentence contains at least two independent clauses joined by a coordinating conjuction, a semicolon or a conjuctive adverb. Independent clauses are groups or words that can stand alone as a sentence because they have both a subject and a predicate and express a complete thought.
The most common way to create a compound sentence is by using a conjuction. Example: I wanted to go for a walk, but it started raining.
I wanted to go fo a walk is an independent clause.
It started raining is also an independent clause.
You can combine both of them by using the conjuction but.