There is no hard rule in terms of who should document user stories, meaning anyone within the Agile Team can document user stories.
Most Agile Teams document user stories as a Team as part of their Sprint Planning process or even before starting the project in what is referred to as “Sprint 0.”
Some Agile Teams assign the responsibility of documenting user stories to the Business Analyst given the nature of this task which in essence relates to project requirements. Other Agile Teams, delegate this to the Scrum Master whilst others rotate the responsibility amongst members of the Agile Team.
Given Agile Teams iterate and continuously improve, start with what you think will work best in your context and for your team and if it’s not working, reflect for improvement in your next Retrospective and adjust accordingly.