There are two situations: first, the onion is bad, not the raw onion is bad, and the raw onion will not be sour if it is bad. It may be that the onion fried in advance in the restaurant has turned sour, so it may be sour; Second, the way of cooking, some restaurants will add sugar to onions with white vinegar, or pickle lemon juice with sugar first to increase the sweet and sour taste. Others put a little sweet and sour when cooking.
The difference between food rancidity and artificially increased acidity is still obvious. If it is not hard to swallow, but delicious, it may be the cooking method.