Bring a large pot of salted water to a boil and cook the penne according to the package instructions until al dente; drain and set aside.
While the pasta cooks, heat the olive oil in a large skillet over medium heat.
Add the chopped onion and diced tomato to the skillet and cook, stirring frequently, until the onion is translucent, about 4–5 minutes.
Stir in the minced garlic, season with salt and pepper, reduce the heat to medium-low, and cook for about 3 minutes.
Sprinkle the flour over the vegetables, cook and stir for 1 minute, then whisk in the milk gradually to prevent lumps. Add the Italian seasoning and bring the mixture to a gentle boil.
Reduce the heat and simmer, stirring occasionally, for 3–4 minutes until the sauce thickens; adjust consistency with more milk or a little extra flour if needed.
Add the hot, drained pasta and the shredded mozzarella to the sauce and stir until the cheese melts and everything is well combined.
Remove from the heat to prevent over-thickening and serve immediately.