For history
https://www.wasterecyclingworkersweek.org/history-of-the-garbage-man/
As to why, it was due to several factors
1.) space. If everywhere is filed with trash you can't move around easily (hence the first landfills).
2.) Cleanliness. Garbage breeds disease. Though they of course didn't know this at the time, they could observe that being around it could lead to dealing worse.
3.) Pollution. This is what really lead to modern day garbage men. Victorian London had this issue in spades wherein they would simply dump trash and chamber pots into the street and wait for it all to wash away (mostly into the Thames River)