Q: Why did the composer only compose while lying in bed?
A: Because he was composing sheet music!
Years ago, when composers wrote music, they would write the music on sheets of paper that the musicians could read and perform. This music written on sheets of paper is called sheet music. Lots of music is written now using computers programs such as Notion or Sibelius. (I do not write music and do not know anything about these programs.) For musicians to perform, the music is most often printed out in sheets, sheet music. There are probably musicians who use a computer or tablet to read their music.
Sheets, though, has another meaning. When you make your bed, you put sheets on your bed, along with pillows and blankets.
This joke is funny because of the different meanings of sheets–sheets for your bed and sheet music. I wouldn’t recommend, however, using bed sheets for writing music; it might be difficult for the performer to read the music!
If you would like to learn to read sheet music, you could start here: