Get your taxes done using TurboTax

I got both an underpayment penalty and a refund for 2019 - how does that work? If I get a refund, doesn't that mean I overpaid? And if I overpaid, how did I get myself into an underpayment penalty situation?