A laptop is obviously not the only device you can use to produce music. People have used phones and tablets to create pro-level music, songs that sound like they were made in a legit studio.
However, a laptop is often the best option for home producers. The main benefit of a laptop when recording at home is its portability. If you need to record in a different room of your house, maybe in your walk-in closet for vocals, you can easily move your recording station. And with a music production laptop, you can also record outside your home, like if you need to go somewhere to record other musicians.