It’s nice when the rules of the language are simple to understand, and when there’s an interesting backstory that’s even better.
In the United States, periods and commas go inside quotation marks regardless of logic….There are peculiar typographical reasons why the period and comma go inside the quotation mark in the United States. The following explanation comes from the “Frequently Asked Questions” file of alt.english.usage: “In the days when printing used raised bits of metal, [periods and commas] were the most delicate, and were in danger of damage (the face of the piece of type might break off from the body, or be bent or dented from above) if they had [quotation marks] on one side and a blank space on the other. Hence the convention arose of always [putting commas and periods inside the closing quotes] regardless of logic.” – via Grammar Guide
Here’s a couple of examples:
John said, “Let’s go down and wade in the brook.”
“I’m afraid I might fall in,” Loretta replied. “But I did say ‘I love to swim.'”
John said, “Let’s go down and wade in the brook”.
“I’m afraid I might fall in”, Loretta replied.”But I did say ‘I love to swim’.”