The question is simple but is so broad that the answer can take up this entire blog post. The main thing is that writers are literate. No writer ever known in history, so far, was born knowing how to read and write but age 30 it may have become second nature.
Only some writers were able to see it coming during childhood. Many had no idea at all until after they had graduated from university or high school. For some it happened soon after they finished. In such cases it was caused as a response to a job opening. One the person was able to fulfill.
Lots of career writers actually studied as preparation: journalism, communications, marketing and English are all degrees which lend themselves towards jobs as professional writers.
Then there are those who are more like outliers: they submit from someplace rather than writing whatever their boss at the company told them to with colleagues at the office. Some of those people actually work in another part of the writing business. Stories of veteran journalists who hope to write their own book someday are not that unusual. I have read stories of how someone working for a publisher is asked to write a book for the company after working there for 5 years. The author gets to be listed as the author and the publisher pays well and everything. I read about a man who was in an IT department and was commissioned to write an actual book. Wow. Meanwhile, others write for any length of time and then spend huge amounts of energy trying to get their short stories or novels or articles etc. accepted for publication in paying markets.
In general writers are people. They can be as flaky or as down to Earth and sensible as the rest of the population. Even though I write professionally myself, I don’t even know what the stereotypes of writers are.