Lower gas price & lower gas limit transacted over mine

Just had a transaction “run out of gas” which means I just paid the gas fee for nothing.

I looked at the other transactions in the block. There were several where the gas price and the gas limit were much lower than mine, yet their transactions went though.

Can someone please explain the logic to me?