The comma goes before.
I am a man. You are a woman.
I am a man, and you are woman.
I am fine but a little bit tired. (note: this is not a compound sentence - hence, no comma.)
I am fine, but I am a little tired. (This is a compound sentence - hence, the comma.)
It is covered here in Grammar Monster.
I think it goes after a sentence and is added when there needs to be a extra thing I think. i do not knoow for sure.....