Pound the chicken breasts to about 1/2 inch thickness so they cook evenly. In a small bowl, mix olive oil, garlic powder, onion powder, chili powder, salt, and pepper. Rub this seasoning over both sides of the chicken.
Preheat your air fryer to 390°F (200°C). Place the chicken breasts in the basket without crowding and cook for 18 minutes, flipping halfway. For a skillet or oven, cook at 400°F for 20–25 minutes until the internal temperature reaches 165°F.
Let the cooked chicken rest for a few minutes to retain its juices, then slice thinly. Drizzle with fresh lemon juice if desired.
Spread mayonnaise on one side of each slice of sourdough. Spread pesto on the opposite slice to create a flavorful base for the sandwich layers.
Layer sliced chicken, mozzarella, and tomato on top of the pesto. Close with the bread, mayo side facing out, for a creamy exterior.
Heat a skillet over medium heat and place sandwiches in the pan. Cook 3–4 minutes on each side until the bread turns golden and the cheese melts. Slice in half and serve warm.