Is it allowed to listen to music while piloting a plane?
Many aviation headsets either have an Aux-jack or a bluetooth connection, and listening to music is specifically mentioned as a feature.

(Link to headset)
(Link to adapter)

Some headsets even have a feature that detects radio-communications, and immediately silences the music.

The FAA has no problem with pilots listening to music provided its not distracting.   Individual company policies may differ.