Preheat your oven to 375°F (190°C). Grease a 9x13-inch (23x33 cm) baking dish.
In a large skillet, brown the ground beef over medium heat, breaking it apart as it cooks. Drain any excess fat.
Add the chopped onion and minced garlic to the skillet with the beef. Sauté until the onion is translucent.
Stir in the diced tomatoes, tomato paste, dried basil, dried oregano, salt, and pepper. Simmer for about 5 minutes to allow the flavors to meld.
In the prepared baking dish, layer half of the cooked macaroni, followed by half of the meat sauce. Sprinkle half of the mozzarella and Parmesan cheeses over the meat sauce. Repeat the layers.
Bake in the preheated oven for 20-25 minutes or until the cheese is bubbly and golden.
Garnish with fresh basil leaves, if desired, before serving.