Preheat the oven to 400°F (200°C).
Melt the butter in a large skillet over medium heat, then add the chopped red onion and sauté for 2 minutes.
Add the chopped red bell pepper to the skillet and sauté for an additional 2 minutes, then remove from heat.
Place the tortellini in a 9×13-inch (3-quart) baking dish. Add the cubed chicken, fresh baby spinach, and the sautéed onions and peppers. Toss gently to combine and spread evenly in the dish.
In a bowl or measuring pitcher, whisk together the basil pesto, chicken broth, heavy cream, 1 teaspoon salt, and 1/2 teaspoon ground black pepper until smooth.
Pour the pesto-cream mixture evenly over the tortellini and chicken in the baking dish.
Cover the baking dish with foil and bake for 20 minutes.
Carefully remove the foil and gently stir the pasta so the top pieces are coated with sauce. Sprinkle the shredded fontina and shaved Parmesan evenly over the top.
Return the dish to the oven and bake uncovered for 15–20 minutes more, until the cheese is melted and the casserole is bubbly. Serve warm.