He was purchased as a simple pet fish, but when he turned into a boy, his owner decided not have a wish granted as is typical with magical fish. Instead, the lonely kid wanted a friend, and so they never wished, thus keeping Mayoreu trapped by the obligation to grant a wish that is never uttered.
Though most of the time he just hangs out in the bath tub reading shojou and eating seaweed.