Onion is charred along with ginger to create the deep flavor of pho broth. The aromatics are blackened or heavily roasted before being added to the stock, giving the soup a smoky, sweet, and savory foundation.
Pho broth usually begins with beef bones, marrow bones, oxtail, or meat, which simmer for hours. Charred onion contributes sweetness and depth, while ginger adds warmth and a distinctive fragrance. The broth is also commonly seasoned with spices such as star anise, cinnamon, cloves, coriander seed, and black cardamom.
The onion is not meant to make the soup taste burnt. Cooks typically remove loose, excessively blackened skin before simmering the aromatic. Shallots can appear in some family recipes, especially for chicken pho, but onion is the standard answer for this general question. The charred aromatics are also one reason pho tastes different from an ordinary beef noodle soup.