comes from the imagery of showing off your grill. you bare your teeth as if you were in front of a mirror flossing. thus showing off your grill came to be known as flossing and flossing came to mean showing off in general

go listen to some rap, youll hear an example of someone using flossin sooner or later