I came by this secret knowledge through years of effort and eventually a revelation. People who have been cool their entire lives probably have this revelation at a young age and then live up to it from then on. Some people will never realize it and even if I explain it, you still might not be able to actually do it. Hank Green has a great video on how to escape the friendzone that is 100% accurate but once you watch it you realize it may not be something you could ever do yourself and that's okay. Maybe you'll find a way to be cool some other way but honestly, I have never seen anyone accomplish it differently.
So now with all the necessary disclosures out of the way, here's a story. For the first ten years of my life, I tried really hard to fit in. Fitting in is not a bad thing, mind you, but I was bad at it. I was able to make friends with people who were pretty and popular and I consumed the media and culture that was popular at the time which made it easy to belong. The problem was that I couldn't keep it up convincingly for very long once you started to get to know me. I didn't think any boy band members were cute and my favorite pop songs were always the weird album tracks no one liked. I didn't dress stylishly because I mainly just let my mom buy my clothes because I didn't know how to have a personal style and generally didn't like whatever was trendy and age appropriate (I wanted to dress more classically adult and somber in a children's section full of bright colors and strange late 90s styles). I thought a lot about my own mortality. I was smart but not witty or clever, my jokes fell flat, I wasn't pretty, my only somewhat notable accomplishment was being the 4th best artist in my year, and I got way too into the worlds of books and television that I liked and made up stories about them in my head. I couldn't be honest with my friends because I knew if I was, they would think I was weird which meant I was the opposite of fitting in.
I went through a depression that started when I was 11 that I think may have been caused by being unable to uphold the facade anymore and ended when I was 13. That might seem short for a depression and something you could easily write off as preteen angst but it was a really hard time for me when I lost all my friends and cried almost every day. However, during one lucid day, I stood in front of a mirror and thought to myself, "You think you're ugly and dumb and not worth anything. What do you need to do to be satisfied with yourself?"
And that's the only step to being cool: Don't give a damn what anyone else thinks of you.
This sounds simplistic, I know, but for most people it's impossible to fully accomplish or at least takes many years. You need to throw out everything you know and start from the beginning. Stop paying attention to trends or at least stop caring about them. Don't buy any clothes you don't absolutely love just because you think you need more. Style your hair the way you think looks best. Decide "social acceptability" is just a hindrance on your happiness. Search deep for music you really enjoy that makes you feel something real and ignore the radio. Stop doing things because you think you have to and try to figure out what will really make you happy and then work towards that instead. Throw out idealism for goals that are reachable even if they take work to achieve. Make efforts towards improving yourself in the way you think is most important. Want to be smarter? Read more. Want to be funnier? Watch how others do it and learn how to think on your feet. Want to be kinder? Do more for others and it will come naturally.
Eventually once you are far enough into this mindset, you will get better and better at expelling outside influence. You will probably lose friends but you will make new ones better suited to you as you really are now. You might realize that when you really stop and think hard about your own life, that you will need to change everything you thought you would do and that's okay. As long as you are living, you get as many chances as you need to pick a new path.
And if you are someone who is able to really detach so fully from all the world is trying to tell you, you will start to realize that people look at you differently. Even if people don't like you (and this process will likely increase the amount of people who don't like you honestly) they will probably respect you deep down. People might start telling you that you are cool or that they love how you are so "you."
And if this has really worked, you won't care at all. Once you are truly cool, being thought of as cool is something you couldn't care less about. You will like who you have become, the people you surround yourself with, and the way you live your life and who cares if someone else likes it or not.
Cool people do not need approval. That's what makes them cool.