Preheat the oven to 350°F (175°C).
Cook the spaghetti in a large pot of salted boiling water according to package directions until al dente; drain and set aside.
While the pasta cooks, place each chicken breast between plastic wrap and pound to about 1/2-inch thickness with a meat mallet or heavy pan.
On a plate, mix the flour with salt and black pepper. Place the whisked egg in a shallow bowl and the breadcrumbs in a separate plate.
Dredge each chicken breast in the seasoned flour, then dip into the egg, letting excess drip off, and press into the breadcrumbs to coat both sides evenly.
Heat the olive oil in a large skillet over medium heat and sauté the breaded chicken in batches so pieces do not crowd; cook about 4 minutes per side until golden and cooked through.
Spread half of the marinara sauce in the bottom of a baking pan. Add the drained spaghetti in an even layer, then arrange the cooked chicken breasts on top.
Pour the remaining marinara over the chicken and pasta, then sprinkle shredded mozzarella and grated Parmesan evenly over the top.
Bake uncovered in the preheated oven for 10 minutes, until the cheese is fully melted and bubbly. Serve warm.