What causes me to get gastritis and esophagitis?

Acid. Most likely culprit is stomach acid. However, bile from the intestine can also cause inflammation in the stomach and esophagus.