Keep humming the melody and try to identify the note which brings it to a pleasing conclusion.
First listen to the song a couple of times, or until you have memorized the melody.
Next pick up the guitar, or the piano (you don’t have to pick up the piano). Hum the melody gently and as you hum try to bring the melody to a satisfying conclusion. Every song has an ending. It is like a curtain-fall. It tells you that it is over and it fills you with satisfaction. It does not leave you hanging in the air (although there are some rare songs which end with an inconclusive note). So, keep humming the melody and try to identify the note which brings it to a pleasing conclusion. You might fail the first time, but with practice you will be able to find the key note quickly.
Suppose the key note is E. Play the E-major chord. Does it suit the key? If you feel like you are sounding odd, try the E-minor chord. Listen carefully and you will be able to decide which chord goes with the key. If E-major sounds fine, the key is E-major. If E-minor sounds good, the key is E-minor.
Once you have determined the key, start adding chords from the related chord family.