I suck at playing guitar. I learn all the chords but never know how to play the music. Friends already tried to teach me talking 'listen to the music', 'listen to the drums', etc, but nothing never worked.
How can I learn this?
Practice clapping along to music. Start with dance music with a heavy clear 4/4 beat (if you're not sure, ask someone to find you some). Clap along to the bass drum and count to four as you do it, so you feel the first beat of each bar.
Also try clapping to the off-beat -- beats 2 and 4 of each bar. Or pick a drum sound and clap to that even if it's a more complicated pattern.
Dancing - of the organised folk kind - can also be a helpful, fun way of driving a sense of rhythm into yourself, as you're stepping forcefully in time to the beat.
If after all of this, you still don't feel the rhythm, if may be that your brain just doesn't work that way. Some people are colourblind; some people are tone deaf; some people are rhythm-deaf. It's OK, and you can enjoy music in other ways.
Without a sense of rhythm, it will be difficult or impossible to play in an ensemble. But you can perform certain styles of music solo. I have an acquaintance with a beautiful voice and a style of finger picking guitar, who's always asked to perform Rod Stewart's "I Don't Want To Talk About It". His bars are as long as he wants them to be.
It does take practice to get the feel of the rhythm. But if you can listen to a song and tap your finger to the beat on a table, then you have the skills needed to learn to play the guitar and keep the rhythm.
The strumming pattern you use will have an effect on your ability to maintain an appropriate rhythm for a particular song. On many patterns you may find it helpful to get your wrist moving up and down like a pendulum and keep it going much the same way as if you rest the heel of your hand on a table and tap your fingers to the beat. Depending on the strum pattern you might intentionally miss the strings on every other up-swing or every other down-swing or every third down swing etc. - depending on the strum pattern you want to use.
I think it might help you develop better rhythm if you practice strumming along to a backing track that has a drum and even the guitar part but is not cluttered with vocals and superfluous instrumentation that would otherwise mask the guitar rhythm.
I recently came across a great site which includes free midi backing tracks for thousands of songs to go along with the lead sheets and chord sheets. The lead sheet will tell you where to put your capo (if needed) to match the midi track. I have found an occasional chord wrong on a few songs but you can download the sheet and manually correct the chords and also download the midi file so you can play along. I have downloaded quite a few of the sheets and corresponding midi backing tracks.
The site is called Betty Lou's Guitar music site and it can be found at Site for free midi backing tracks You should be able to find some songs you know on this site. Give it a try.
Don't give up, you will get it eventually and then you will wonder why you ever had any trouble because it will become natural. Good luck.