Both are grammatical. They are simply two different tenses - past perfect and simple past. It's just like two different shapes - a circle and a square, for example.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.