Preheat your oven to 375°F (190°C).
In a large skillet, heat the olive oil over medium heat. Add the diced onion and cook until softened, about 3-4 minutes.
Add the minced garlic and ground beef to the skillet. Cook until the beef is browned and cooked through, breaking it up with a spoon, about 5-7 minutes. Drain any excess fat.
Stir in the Italian seasoning, salt, and black pepper. Add the diced tomatoes (with juice), gnocchi, and beef broth. Bring to a simmer and cook for about 5 minutes, allowing the gnocchi to soften slightly.
Transfer the mixture to a greased 9x13-inch baking dish. Sprinkle the mozzarella and Parmesan cheese evenly over the top.
Bake in the preheated oven for 20-25 minutes, or until the cheese is bubbly and golden brown.
Remove from the oven and let it cool for a few minutes. Garnish with fresh basil if desired before serving.