Author
An author is someone who creates and publishes original written works, such as books, articles, essays, or other long-form content. The term usually implies ownership of the intellectual content and often a finished, published product. Authors are commonly associated with books (fiction or nonfiction), academic papers, or other formal publications.
Writer
A writer is anyone who produces written content, which can include authors but also covers a broader range of writing tasks. Writers may create articles, blog posts, marketing copy, scripts, social media content, or other forms of text. Not all writers are authors, because their work may not be original long-form works or formally published under their name.
In short, all authors are writers, but not all writers are authors. Authors typically have original, published works attributed to them, while writers can produce a variety of written materials in many contexts.