Preheat your oven to 350°F (175°C).
In a large skillet, heat the olive oil over medium heat. Add the diced onion and minced garlic, sautéing until the onion is translucent, about 3-4 minutes.
Add the ground beef to the skillet, breaking it apart with a spoon. Cook until browned and no longer pink, about 5-7 minutes. Drain any excess fat.
Stir in the sliced zucchinis, diced tomatoes (with their juice), Italian seasoning, salt, and black pepper. If using, add the cooked rice. Cook for an additional 5 minutes, allowing the zucchinis to soften slightly.
Transfer the mixture to a greased 9x13-inch baking dish. Sprinkle the mozzarella and Parmesan cheeses evenly over the top.
Bake in the preheated oven for 25-30 minutes, or until the cheese is melted and bubbly.
Let the casserole cool for 5 minutes before serving.