Preheat oven to 375°F (190°C).
Cook lentils in boiling water until tender, about 20 minutes. Drain and set aside.
In a large pan, heat olive oil over medium heat. Add onion, garlic, carrot, and celery. Sauté until softened, about 5 minutes.
Add cooked lentils, vegetable broth, thyme, rosemary, salt, and pepper. Simmer for 10 minutes.
Transfer lentil mixture to a baking dish. Spread mashed potatoes evenly on top.
Bake in preheated oven for 20 minutes, until the top is golden brown.