The short answer is: ear training.
Having a good ear for music means being able to hear accurately and understand what you’re hearing.
Here at EasyEarTraining.com we define “ear training” as “any activity you do to improve your aural skills” – and so the process of developing a good ear is: ear training!
This can be as relaxed and generally as listening to lots of music from different genres to develop your music appreciation, or highly specific rigorous exercises, targeting particular skills such as interval recognition.
Whichever area you focus on and whatever methods you choose, if you want a good ear for music you must spend time improving your aural skills with ear training.