Well:
1) Accidental warehouse fire
2) Intentional fire, but accidental ammonium nitrate explosion
3) Intentional ammonium nitrate explosion
I can't see major players (states, extremist groups) doing (3) because I can't see what the benefits would be, especially compared to the reputation cost of being exposed. The port of Beirut isn't high value, or with symbolic significance, and it hurts all communities of Lebanon. Also, I'd expect them just blow up the nitrate, not start a fire and hope it spread.
Realistically, some variant of accidental warehouse/facility fire (they're hardly rare occurrences) along the lines of (1) and (2) seems the most plausible. China had a massive one a few years back. The UK and US have had them recently too, although usually far less serious because we tend to keep really dangerous stuff away from heavily populated areas.