Many of the larger galaxies in the game have comet missions attached to them. As you play through the game, you will eventually notice a purple Luma appear near Rosalina. This Luma can help you control the comets as they wander around the multiple galaxies; pay it 20 star bits to move the comets to a different galaxy if you don't want to play the missions that they offer.
There are four types of comet missions that you will encounter. Each galaxy only has one comet mission of a specific type. In other words, you'll always encounter a Speedy Comet above the Good Egg Galaxy; it'll never be a Daredevil or Fast Foe comet, or anything else.
Speedy Comet: You have to complete the entire mission while operating under a time limit. The mission itself is otherwise unchanged, so if you've already played it you will at least have the advantage of knowing what to do. Ignore out-of-the-way coins and powerups, and focus on getting your job done here.
Cosmic Comet: Cosmic Comets will reveal a cosmic Mario twin that you have to race in order to get to the Power Star first. The easiest way to complete these is to simply hang back, watch your twin maneuver the course, die and restart, and then do everything your twin did, but do it more rapidly.
Daredevil Comet: Annoyingly, these comets force you to replay part of a mission (usually a boss fight) with only one sliver of life remaining. There are no coins to heal with, so if you take any damage, you die.
Fast Foe Comet: Your enemies will move twice as fast in fast foe missions, but apart from that these missions are much the same as they were previously.