"The brain is in the head."
Translation:Das Gehirn ist im Kopf.
"in" is a variable preposition that can take either accusative or dative. A quick mnemonic to help remember which to use is "DRAM - dative rest, accusative motion" (it's not 100% fool-proof, but it helps most of the time). So basically, if you are describing the position of something as stationary, it's dative (I am in the city -> Ich bin in der Stadt), but if you are describing motion to a destination, it's accusative (I am going into the city -> Ich gehe in die Stadt). Here, "the brain" is stationary, "in the head", so you use dative to describe it's position.
Words like in, auf, vor, durch, etc. are called prepositions. They are one topic that requires significant memorisation in German, because they are divided into categories based on which case they require after them (accusative, dative, or "it depends").
The preposition in is in the "it depends" category. This means that whether it requires accusative or dative after it depends on the meaning it has. In English we use "in" to mean two different things, if you think about it: "into" ("I am going in the house") or "within" ("I am in the house"). The difference between "into" and "within" is that "into" is describing changing from one location to another, and "within" is talking about being entirely at one location. This distinction corresponds to the German rule that decides whether the "it depends" prepositions require accusative (changing location) or dative (at one location).
Here, we are using in to mean "within" (i.e. at one location), so we need dative case for what follows it (Kopf). If you used accusative case instead, it would have the meaning "The brain is into the head", which doesn't make sense.