Comes from a way of describing hot dogs on a bun. Hotdogs are pretty tasty and we all know eating tasty things are fun to do. Thus you get fun on a bun. Generally used as a compliment.
Boys who enjoy yaoi (a genre in Japan that contains sexual and/or romantic relations between two men); literally translates to "rotten boy"; corresponding female : fujoshi