From 玉葱, from 玉(“ball”) +ねぎ(“scallion, green onion”), literally “ball scallion”.
Note that in Japanese, 葱 (green onion) is the more basic term from which “onion” is derived, while in English it is the reverse – “onion” is basic, while “green onion” is derived from it, reflecting the different importance in cuisine (葱 is more basic to Japanese cuisine, onion is more basic to English cuisine).