When you "have a song stuck in your head", it means that you keep thinking about the song and can't stop playing it over and over in your mind.
The word "stuck" means "not able to get out". Some other ways that "stuck" is used include:
- get stuck in traffic
- be stuck between ___ and ___
- get stuck in the mud
- (food) gets stuck to the frying pan
To "have a song stuck in your head" is a continuing situation. If you want to describe how the situation started, you say that you "got a song stuck in your head".