Garfield Logan (Beast Boy) contracted Sakutia (Green Monkey Fever), a rare, fatal disease. His parents, scientists, developed an experimental serum using animal DNA to save him. It cured him but mutated his genome, granting shapeshifting into any animal (green skin/hair as side effect).
In the animated series, this origin is simplified: the serum (from his parents' lab) gave him powers directly. The core tragedy: he lost his parents young, and his powers isolate him — until the Titans become his family.