Challenge coins are a military tradition. They are generally used by commanders to commend an achievement or action that is noteworthy, but not to the level necessitating going through awards channels. A common situation where I have seen them given out is when an GO/FO comes to a particular command and a junior enlisted member gives a brief about what they do and/or what equipment they operate. Typically, these junior members are the shining stars in that command. Additionally, when higher level commanders give briefs, I have seen them give out coins to people who asked questions. There is no real set criteria to receive on, though. Overall, they are a cool way to document one's service.
There is also an old tradition where they are used to determine who would buy drinks at the bar. If you challenge someone (ask them to present a challenge coin to see if they have one on their person) and they don't, and you do, they buy drinks. If they have their coin, you buy. There is also a pecking order on challenge coins. So, if both people present, and one is from an O-6 and another one is from an O-10, then the person who produced the O-6 coin would by drinks. I have never seen it play out in real life, but I'd say most are at least a bit familiar with the traditions surrounding challenge coins.