Why write fiction?
Because you are free to say whatever you want.
You can create a crazy character that says all the things you have always wanted to say but were too embarassed to. You have just to be sure to kill that character before the end of the story.
There are many things we would like to tell the whole world but we are too embarassed to say, because they may be illegal, immoral, embarassing, offensive, shocking, etc.
How can you criticize the government? How can you defend ideas that are highly impopular in the society? How can you tell the whole world about the times you were fired, rejected, depressed, embarassed?
In order to survive we have to be hypocrites. We have to pretend to be honest, good, virtuous, friendly, balanced. We have to open a Facebook account and post lots of smiling pictures.
Do writers write to entertain the readers, sell books and make money?
Yes, but that is probably not the main reason writers write. Making money is not a reason strong enough to write. There are many other better ways to make money. This kind of profession is tough. Unless your name is J. K. Rowling, chances are that you are not going to survive by writing.
Writers write to release the demons inside their souls. Writers write to look for salvation. The writer aims to find order and peace of the soul by letting out on paper all the chaos inside the mind. Writing is a confession.
How can you do this? One way is by being anonymous. The other way is by writing fiction. You create a character, most cases a villain, and make him say all the terrible, horrible things you don't dare to say in public. That is OK, since the character is a villain, he will be killed at the end of the story. And because it is fiction " any resemblance to actual persons or facts is purely coincidental".
"Fiction is just entertainment. Don't take it seriously. Whatever the characters may say, they do not reflect the writer's opinions."
I have never written fiction. Never found a reason to write fiction. Until now.
Because there are severe limitations in writing non-fiction. You have to be a hypocrite when writing non-fiction. Hypocrisy leads to loneliness. To be unable to say the things you are really thinking. To not find a friend to share your burdens. To be unable to talk about the things that really matter.