Because in most jurisdictions, at least in North America, it is legal to list your house "For Sale By Owner" without a real estate license. [0][1]
[0] https://www.investopedia.com/terms/f/for-sale-by-owner.asp
As an agent you will likely split your commission with your broker, usually 50% for new agent but you can find some that offer take only 30% or even less.
For me, it was a little bit of impulse decision, we are planning to sell our townhome and move to a house in next few years. But also we have been looking into real estate investments.
We need to close one transaction a year to breakeven on cost of real estate license. Probably not worth it but now that I have license and I will helping friends and family and hopefully it will be worth it.
Also like others have said if you are selling your own home, you most likely don't need a license.