I have gotten a bad stomach because I had eaten a wrong food earlier.
Is that sentence grammatically correct?
English Language Learners Stack Exchange is a question and answer site for speakers of other languages learning English. It only takes a minute to sign up.Sign up to join this community
No, it is not correct.
The perfect designates a state at the time you are speaking about (your 'Reference Time') which arises out of a prior eventuality: an event or state which occurred at some time before Reference Time.
So the present perfect is a present tense: its Reference Time is the present and it designates a present state which arises out of a past eventuality.
The past perfect is a past tense: its Reference Time is some point in the past and it designates a state at that time which arose out of some event before that time.
In your sentence, your main clause employs the present perfect; it is a statement about your present state: the stomach-ache which you have now. It establishes a present Reference Time, and the time of the eventuality in the subordinate clause must be expressed relative to the present—ordinarily, with a simple past:
... because I ate bad food.
But a present perfect is also acceptable in the subordinate clause:
... because I've eaten bad food.
I've deleted "earlier" because we ordinarily use "earlier" in the same way as a past perfect: to refer to an eventuality before a past Reference Time. With a present Reference Time it is superfluous to speak of an eventuality cast in the past tense as "earlier": the notion of 'earlier than now' is built in to the past tense.
Note, too, that we do not speak of a food—food is a non-count noun; we do not usually speak of wrong food but of bad (or spoiled) food.
Moreover, it is unlikely that anyone would say "I have gotten" a stomach-ache; we ordinarily say "I have" or, more colloquially, "I've got" a stomach-ache. And in speaking of the cause of a disease or disorder we're more likely to use a from+gerund preposition phrase than a because clause
I've got a stomach-ache from eating bad food.