ESP8266 clocking out when connecting to ATmega2560 or ATmega328

Attempt 1: I followed this guide: https://www.instructables.com/Getting-Started-With-the-ESP8266-ESP-01/#discuss and got to step 3 where it says to upload the "BareMinimum" example from 01.Basics example. I keep getting this error when having everything connected like in the guide up till step 3 but i can never get it to flash correctly. Same results if I switch up the TX and RX connections, ground the RST pin, and use an external power supply for the ESP8266-01.
The error message says: esptool.FatalError: Failed to connect to ESP8266: Invalid head of packet (0x1C).

Attempt 2: Tried using library version 2.5.0 instead of 3.0.2 (newest)

Attempt 3: Used the sample code below

#include <Arduino.h>

void setup() {
  Serial.begin(9600);
}

void loop() {
  delay(1000);
  Serial.println("Hello World!");
}

Link 2: https://create.arduino.cc/projecthub/pratikdesai/how-to-program-esp8266-esp-01-module-with-arduino-uno-598166

What this code has to do with ESP8266 upload?

I was able to get the ESP8266-01 to connect to my Arduino Mega 2560. This was allowed thanks to connecting GPIO1 to GND but connecting a 10kohm resistor in between. Library for the esp8266 was the 2.5.0 version.