onions and garlic must be cooked first so that it adds flavor to the oil. this way, the taste is absorbed better by the food that's being cooked, such as pork or beef. as stated earlier, onions go first and garlic later. the last-second inclusion of garlic in the cooking process allows for a more robust garlic flavor.