Early warships fired iron cannonballs from a stack piled next to the cannon.
To keep them in place, they used a square piece of rust-proof brass with indentations to secure the bottom layer of balls.
This plate was nicknamed the monkey.
When it got cold enough, the mischievous brass monkey would shrink, causing the balls to fall out and roll all over the deck.
That gave us the expression “cold enough to freeze the balls off a brass monkey.”