Seeing the Samsung Galaxy S5 was released in 2014 and Optus stopped selling them around 2016 its been a minimum of 3 years if not more since it was purchased.
Batteries have a limited lifecycle e.g. cycles of charging, discharging and so forth.
No recalls (unlike Note 7) for the S5 that I have seen.
And it was always charged with the charger it came with?
What could Optus do in this case?
I assume its the original battery?
What do you mean by exploded? Smoke? Fire? Phone Debris?
You don't have any real consumer rights after this amount of time but if you want to investigate legal action talk to a lawyer.
That said, given Samsung lost around $5 billion with a total recal of the S7 series as a few batteries "exploded" I'm sure they'll take the matter seriously if you contact them.
Its not a known issue for the S5 series but perhaps they'll off you a replacement?
The battery acted like a volcano, emitting a chemical plume into the house, It was red hot for at least 30 minutes . Without my quick action a nearby plant cover which was smouldlering could have caught fire.
The phone was on the original charger and had the original battery installed.