Some people do it for resume points.
Personally, I open-source my random crap because it’s possible that someone else had a similar problem and would appreciate a pre-made solution. I have been on the receiving end of that many times, and paying it forward is the least I can do.
This just in, a delusional business owner. More news at 11.