In some states it's legal to drive with earbuds in your ear although you could still get a ticket for distracted driving.
It is legal to drive while wearing earbuds or headphones in some states but other states make it illegal to wear headphones or earbuds.
The states that it is legal to wear headphones while driving or earbuds while driving are Alabama, Arizona, Arkansas, Connecticut, Delaware, Hawaii, Idaho, Indiana, Iowa, Kansas, Kentucky, Maine, Michigan, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, North Carolina, North Dakota, Oklahoma, Oregon.
However if you get pulled over and the police consider that the wearing of headphones or earbuds has impaired a driver's ability to drive safely, they can choose to ticket you for careless or even dangerous driving.
There are various penalties for different careless driving offenses, and it's up to the charging police officer to decide on the offense.
Even if it isn't illegal in your state to drive with earbuds or headphones it still is dangerous and takes your attention off the road and can prevent you from hearing other things around you including emergency vehicle sirens etc.
I would not wear earbuds or headphones while driving as I need to completely be aware of my surroundings.
If I want to listen to music I will listen to the radio itself without earbuds or headphones.
In California, it is illegal to wear Bluetooth headphones in both ears while driving.
The California Vehicle Code states that an individual operating a motor vehicle or bicycle may not have both ears covered by a headset, earplugs, or earphones unless an explicit exception to this rule applies.