Welcome to the forum
It is doing what you programmed it to do
for (int i = 15; i <= 165; i++)
{
myServo.write(i);
delay(30);
distance = calculateDistance(); // Calls a function for calculating the distance measured by the Ultrasonic sensor for each degree
Serial.print(i); // Sends the current degree into the Serial Port
Serial.print(","); // Sends addition character right next to the previous value needed later in the Processing IDE for indexing
Serial.print(distance); // Sends the distance value into the Serial Port
Serial.print("."); // Sends addition character right next to the previous value needed later in the Processing IDE for indexing
}