The developer has to do this. It's not something you can magically do.
Apple publish developer guidelines for making an app CarPlay-compatible. This includes app functionality (is it something that legitimately makes sense to use while driving (i.e. games are out)), usability (does the user interface fit with the CarPlay guidelines on screen layout, input controls, etc.
A developer has to submit their app to Apple (similar to how they're submitted to the App Store), and if Apple approves that the app meets the guidelines, they get a CarPlay entitlement that iOS recognizes and uses to make the app appear in CarPlay.
If you have time to kill, you can read more about the guidelines at https://developer.apple.com/carplay/documentation/CarPlay-App-Programming-Guide.pdf
Suffice to say, you don't have any control over this. The app developer does.