ELI5: Why might it be better to invest rather than hastily paying off your mortgage?

I’m confused why rapidly reducing a ~$400k mortgage using extra funds isn’t recommended when there’s a substantial retirement investment portfolio available. Could someone simplify the rationale?

I’ve found that investing might offer compound growth which can sometimes outpace mortgage interest rates, especially when tax benefits come into play. Has anyone compared their numbers and seen if this strategy really pays off long term?

sometimes investin offers more flexiblity and higher potential gains than just lockin up extra cash in your house. taking a risk on the markets can pay off if your portfolio grows, even if it means a bit of debt remains.