Bring a large pot of salted water to a boil and cook the penne according to 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, about 5 minutes until the onion is translucent.
Stir in the minced garlic, season with salt and pepper to taste, and reduce the heat to medium-low; cook and stir for about 3 minutes.
Add the flour to the skillet, stir into the vegetables, and cook for 1 minute to remove the raw flour taste.
Gradually whisk in the milk, then add the Italian seasoning and bring the mixture to a gentle boil while whisking to prevent lumps.
Reduce the heat and simmer, stirring occasionally, for 3–4 minutes until the sauce thickens; adjust thickness with more milk or a little extra flour if needed.
Add the hot, drained pasta and shredded mozzarella to the sauce and stir until the cheese is melted and everything is combined.
Remove from heat to prevent the sauce from becoming too thick, serve immediately, and enjoy.