Preheat the oven to 375 degrees F (190 degrees C). Spray a medium or large casserole dish with cooking spray.
Heat oil in a large skillet over medium-high heat. Add onions and a generous pinch of salt and pepper; saute until onions are translucent, about 5 minutes. Transfer to a large mixing bowl.
Add cooked chicken to the onions. Mix in spinach and cream cheese until combined; you can add spinach a little bit at a time to make it easier. Add 1/2 of the mozzarella cheese and stir until everything is thoroughly incorporated and cream cheese has no clumps remaining. Transfer to the prepared casserole dish and sprinkle with remaining mozzarella.
Bake in the preheated oven until cheese has melted and filling is bubbling, about 30 minutes. Let cool for 10 minutes before serving.