I was diagnosed with gastroenteritis and the doctor did not give me medicine. Why?

Usually resolves. Without medications. Start w clear liquid like water, slightly flattened soda that is clear, or sports hydration drinks. Sip, sip, sip. Work up to solids w bland foods like bananas, rice, applesauce, toast, gelatin, or chicken. Avoid alcohol, nicotine, caffeine, dairy & high fat foods. Rest.
Virus. Gastroenteritis is usually caused by a virus and usually is self limiting treated with diet and kaopectate or Imodium (loperamide) if needed. Some cases are caused by food poisoning and they are also managed the same way unless they are due to certain bacteria which require antibiotics.