Preheat your oven to 350°F.
In a large skillet over medium heat, brown the ground beef with the chopped onion and minced garlic until the beef is no longer pink. Drain excess fat.
Stir in the diced tomatoes, tomato sauce, oregano, basil, salt, and pepper. Simmer for about 5 minutes.
In a large mixing bowl, combine the cooked macaroni, beef mixture, and frozen peas (if using). Mix well.
Transfer the mixture to a greased 9x13-inch baking dish. Sprinkle the shredded cheddar cheese evenly over the top.
In a small bowl, mix the crushed cornflakes with the melted butter, then sprinkle this mixture over the cheese layer.
Bake in the preheated oven for 25-30 minutes or until the casserole is bubbly and the topping is golden brown.
Let it cool for 5 minutes before serving.