I consider the comma one of the most important punctuation marks in grammar, and the most misunderstood. Many think they know how to use it, but they really don't. Some writers don't use it enough others toss them around like glitter on a child's poster board painting. Although it can be confusing, I will try to break it down for you starting with the simple sentences.
Simple sentences, sometimes called independent clauses, can be joined to keep similar thoughts together. To join two or more sentences, you have two choices:
1) Connect them with a comma followed by a conjunction, or
2) Connect them with a semicolon and no conjunction.
The two sentences joined should relate to the same thought. That is why you want them to be together not separate by a period.
Being a man I will use this punctuation in terms of driving hoping to give you a better visual aid. The punctuation signifies varying degrees of slow-down or stop for the reader. The comma with the conjunction will be a slow-down, and the semicolon will be a semi stop; the period will be a complete stop.
The two cars crashed at a busy intersection; three witnesses called it a fender-bender. (Two simple sentences put together with a semi-colon [semi stop].) Please notice how the second sentence continues the thought of the first.
Two cars crashed, and both front headlights were broken on one car, and the other car didn't appear scratched. (Three simple sentences connected with comma/and.)
The comma before the conjunction tells the reader that a new sentence is beginning. The subject may change. Sometimes a pronoun is used in place of the former subject. (Without a subject change, the sentence may be a simple sentence with two verbs, not requiring a comma: Two fenders were demolished on one car and had to be replaced.)
3) Step three is using a comma between two main clauses joined together by a coordinating connective.
Place a comma before a coordinating connective (and, but, for, or, nor, so, and yet) when it joins two main clauses.
The outfielder dropped the fly ball, and the runner on third base scored.
The following sentence does not have a comma before the connective. In this sentence, and, connects the two parts of a compound verb, not two main clauses.
The outfielder dropped the ball and committed an error.
Don't just put that comma anywhere. If you want to write do the job right.