A compound sentence is made up of two independent clauses joined together with a coordinating conjunction.
There are seven coordination conjunctions, and an easy way to remember them is the acronym FANBOYS.

Let’s break this down a little further and talk about commas, fanboys, and indie clauses and how they all work together to help you influence
An independent clause is a sentence that can stand on its own. At the very least, it has a subject and a verb.
Jack was a great kisser.
Steve really knew how to dance.
Let’s combine those to make a few compound sentences.
Jack was a great kisser, but Steve really knew how to dance.
Jack was a great kisser, and Steve really knew how to dance.
Most of the time you will want a comma before the coordinating conjunctions. English teachers over the years may have told you they are unnecessary. This rule comes from the world of journalism, where commas were often omitted to save paper, ink, and labor back when typesetters used print blocks. That same logic is behind the omission of the serial or Oxford comma in news media.
In the world of fiction, however, commas are a writer’s friend.
They allow us to influence reading speed, which impacts reader emotion. Omitting them can increase tension by making readers speed up, or they can slow moments down when we want readers to really feel the emotions in the scene.
But commas are also there to help readers make greater sense of our words. There are times you won’t need the comma in a compound sentence, but it’s important to make those choices with purpose.
When the independent clauses are highly related and short, you can omit the comma.
Jack was a great kisser and he really knew how to use his tongue.
The second independent clause describing his amazing tongue usage is so closely related to the kissing that I wouldn’t put a comma in here. Steve isn’t referring to cherry-stem-tying skills here, after all.
Is it wrong to put one in? No. You certainly can, especially if you want to slow the pacing, but pay attention to the sentences around the one you’re working on.
We walked to the store and Jack held my hand.
Here are two short clauses that are related because Jack held Steve’s hand as they walked to the store. If Jack held his hand at another time, then this wouldn’t work.
Variety is the spice of life, and many readers take a mental breath when they see a comma. No need to make your readers hyperventilate though.
That brings me to another exception. At the climax of your story, you may want readers to pick up their reading pace, so leave commas out. Reserve this for moments where you want the reader to not catch a breath so they turn the pages even faster.
Commas disappear for most people when reading, at least when put in the proper places. They are a tool for us to utilize and to help mold the emotion of the story, so omit them before FANBOYS wisely.