Bitte (wie von @HotSystems geschrieben) Deinen Code aus der Arduino IDE mittels des Menüpunkts "Bearbeiten/Für Forum kopieren" in die Zwischenablage übernehmen und dann von dort in den Post einfügen.
Sonst müssen wir zu viel raten ...
Die von Dir verwendete Adafruit_GFX.h unterstützt die Funktion setRotation() bei OLED Displays.
Der Aufruf lautet in Deinem Fall (aller Voraussicht nach ...) :
display.setRotation(0); // für die Standardausrichtung
display.setRotation(1); // für eine um 90° nach rechts gedrehte Ausrichtung
display.setRotation(2); // für die um 180° gedrehte Ausrichtung
display.setRotation(3); // für eine um 90° nach links gedrehte Ausrichtung
Ich "bastle" gerade mal auf Wokwi ein einfaches Bespiel dafür und poste den Code und den Link in Kürze an dieser Stelle:
EDIT:
Der Testsketch:
/**************************************************************************
This is an example for our Monochrome OLEDs based on SSD1306 drivers
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/category/63_98
This example is for a 128x64 pixel display using I2C to communicate
3 pins are required to interface (two I2C and one reset).
Adafruit invests time and resources providing this open
source code, please support Adafruit and open-source
hardware by purchasing products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries,
with contributions from the open source community.
BSD license, check license.txt for more information
All text above, and the splash screen below must be
included in any redistribution.
**************************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
// Show initial display buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
display.display();
delay(2000); // Pause for 2 seconds
}
byte rot = 0;
void loop() {
display.setRotation(rot);
printRot(rot);
testdrawchar(); // Draw characters of the default font
testdrawstyles(); // Draw 'stylized' characters
rot++;
if (rot > 3) rot = 0;
}
void printRot(byte r){
String buff;
switch(r){
case 0: buff = "Ungedreht";
break;
case 1 : buff = "90° nach rechts";
break;
case 2 : buff = "180° gedreht";
break;
case 3: buff = "90° nach links";
break;
}
Serial.println(buff);
}
void testdrawchar(void) {
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.setCursor(0, 0); // Start at top-left corner
display.cp437(true); // Use full 256 char 'Code Page 437' font
// Not all the characters will fit on the display. This is normal.
// Library will draw what it can and the rest will be clipped.
for(int16_t i=0; i<256; i++) {
if(i == '\n') display.write(' ');
else display.write(i);
}
display.display();
delay(2000);
}
void testdrawstyles(void) {
display.clearDisplay();
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // Draw white text
display.setCursor(0,0); // Start at top-left corner
display.println(F("Hello, world!"));
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
display.println(3.141592);
display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(SSD1306_WHITE);
display.print(F("0x")); display.println(0xDEADBEEF, HEX);
display.display();
delay(2000);
}
Link https://wokwi.com/projects/336444753041162836
Da ich das Adafruit-Beispiel als Grundlage verwendet habe, habe ich dern Wunsch respektiert und Kopfkommentar (wie auch den Splashscreen) mal dringelassen ... 
Ich lasse im angepassten Beispiel in der loop() die Rotation von 0 bis 3 (und dann wieder mit Null beginnend) durchlaufen.
Wie ich bereits ganz oben schrieb, muss der Aufruf ggf. nur einmal (dann günstig im setup()) getätigt werden. Man kann natürlich auch im Programmverlauf die Ausrichtung ändern, wenn es gebraucht wird ...