There are a lot of "reasons" why. Most argue that it was fueled by a lot of 18 year olds that flamed out and were unsuccessful in the league in the late 90s and early 2000s. There is a great book that came out recently detailing that time period.
Some people say this is to protect the players and give them a degree to fall back on, but IMO it has become much more obvious lately that it is a free way to scout players for another year and see them compete against each other to get a better handle of who is worth investing in. The NBA is planning on dropping this age requirement back to 18 in the next several years.
As for what they study, the answer is typically not very much. Some of these players are basically physically ready to play in the NBA at 16 and college is a complete waste of time. They just need to pass their classes in the first semester (or first two quarters) to stay eligible through the post-season in March before dropping out and preparing for the draft. It is a farce. Ben Simmons is a recent example if you want to read about it or watch his documentary. 
Football is a little different. The requirement is 3 years from HS graduation and very few players are physically ready for the NFL at 18. Careers are also much shorter in the NFL, so you really only see players skipping a few games at the end of their final college season to stay healthy for the draft.
Baseball has the best system in my opinion. You can be drafted out of HS or Junior College, but, if you turn that down or are not drafted, you aren't eligible until you turn 21 or finish your 3rd year.
This system wouldn't work well as well in the NBA because of how their contracts work, but this is already way too long of a post.
Get dozens of book recommendations delivered straight to your inbox every Thursday.