What’s the point of an emergency fund?

I(22m) have 80k in ETFs through a combination of 401k and a personal brokerage, and 5k in my checking account.

If I have an emergency, could I not just sell off some of my portfolio to pay for what I need?

I also don’t see the point of HYSA, since the stock market generates higher expected returns.

Can someone explain the need for an emergency fund in my case?