Like anywhere else, there are a number of social obligations in Japanese society, and one of the most common ones you’ll run into is omiyage. Most easily translated as “souvenir,” omiyage is somehow both more and less than that.
Any time you go on a trip or go to an unusual event, it is expected that you will return bearing gifts. However, most of these gifts are not things to be kept and cherished, but rather food to be quickly consumed and forgotten – space is at a premium in Japan, and so the best gift is something that takes up little space, preferably none. Sure, there is the odd ear cleaner for your grandfather or mobile phone strap for your girlfriend, but since you need to have something for everybody in the class or office, the most common item is a box of small confectionaries. Ideally these sweets are a local specialty of whatever place you travelled to, or otherwise represent that place in some way, but often they are just cakes or chocolates that some company has put in a shiny box.
In fact, the actual contents of the gift don’t really matter. In a perfect example of “it’s the thought that counts,” everyone will happily accept your gift and exclaim that it is indeed very delicious. It doesn’t matter that even though you went to Hokkaido, you actually bought your omiyage at Narita Airport. The point is, you went away and returned bearing a box of over-priced mochi.