Some grocery store foods are treated with growth retardants to stop this from happening, but, if yours is sprouting, it’s good to grow.
The secret to most vegetable regrowing is the presence of the stem-growing tip, which for onions is the base where the little hairy roots grow.
You can grow/regrow your sprouted onion as a houseplant in a sunny location or plant it in your garden (either in containers or the ground). Often there are several plants sprouting within each onion.
How can I prevent onions and garlic from sprouting?
Light and warmth are the culprits.
Store both in a cool, dark, dry place with temperatures between 55 to 65°F (13 to 18°C). This is often a lower temperature than we have in our kitchens.
Moderate humidity will help prevent drying out.