Doctrine and Covenants 1 is a warning but also an invitation to come unto Christ. It is not chronologically the first revelation that Joseph Smith received; it was received in 1831 as a preface to the book of revelations, which would be published about a year later.
“The Lord’s Preface (D&C 1),” Jeffrey R. Holland
Section 1 begins with frightening verses that show “we are in big trouble.” We can begin to ascend only through the principles and ordinances of the gospel of Jesus Christ. The Doctrine and Covenants preface is dedicated to help us understand how to worship and what we worship, and to reenthrone God among all people.
“Revelation, 1 November 1831-B [D&C 1],” Historical Introduction, The Joseph Smith Papers
On 1 November 1831, William McLellin, Sidney Rigdon, and Oliver Cowdery, being in a conference of elders, were assigned to write a preface to the first publication of Joseph’s revelations. When they presented their draft to the conference, the elders “picked it all to pieces” and requested that Joseph petition the Lord for a preface. This revelation told why God revealed these commandments and warned people of God’s wrath against the wicked.
More on the history of the publication of D&C 1:
Publishing the Revelations, The Joseph Smith Papers
“The Explanatory Introduction: A Guide to the Doctrine and Covenants,” by Craig K. Manscill
The introduction shows that revelations are given in times of real need to real people, and these revelations explain the unfolding of the events of the Restoration. Note that the title “Explanatory Introduction” was renamed “Introduction” in the 2013 edition of the Doctrine and Covenants.