If I'm racing laps I'll usually have someone handing up bottles in which case the top of the gel (the tear off part) is tucked inside the bottle lid so all I have to do is tear off the gel, squirt it down and tuck the wrapper in a pocket or up trouser leg. Or… if it's a "serious" race there might be a 'gel drop' after the feed zone. In that case I'll lob the wrapper in the general direction of whatever the organisers have propped up as a container.
If it's not laps or it's over 90 minutes and I've not got anyone 'handing up' then there is usually plenty of time to deal with both parts of the wrapper. Again, trouser leg comes in useful.
There's always exceptions though. The Brownbacks series at Lee Quarry has 'no outside assistance' (so no handups) and a strict no littering policy. Also it's a technical course with hardly anywhere to have a drink let alone open a gel – cue gel mess all over the place 😉