For before and after a workout, we want carbs that digest quickly, so we can absorb and use them as quickly as possible.
For pre-workout, this means those carbs can get broken down into our bloodstream quicker, and give us more easily accessible energy during our workout.
For post-workout, it means we can start the recovery process quicker, to give us a better chance at recovering well for the next workout.
Fast-digesting carbs also tend to include some foods we tend to think are "bad". Sugary foods, and those with refined carbohydrates are often avoided, but they can actually be a tool if used around your workout! This also means that if you like to have some sort of sweet treat during the day, you can make the most of it by having it before or after your workout.