Why do old dial-up modems make weird sounds when connecting to the Internet?
Old dial-up modems make weird sounds when connecting to the Internet because of the way they transmit data over the telephone line.

When a user dials a phone number to connect to the Internet, the modem sends a series of tones over the line to establish a connection with the remote modem on the other end. These tones are actually a form of digital data that the modems use to negotiate the terms of the connection, such as the speed and error correction methods to be used.

The sounds that you hear when a dial-up modem is connecting are the actual tones being transmitted over the telephone line. Specifically, the modem is sending a sequence of audio tones at different frequencies and durations that represent the digital data being exchanged. These sounds are often described as a series of beeps, screeches, and static-like noises, which can be quite loud and annoying.

The reason for these sounds is that the modem is essentially translating digital data into an analog signal that can be transmitted over the telephone line. Because the data is being transmitted over a voice line, the modem has to use audio tones to convey the digital information.

With the advent of broadband Internet, dial-up modems have largely become obsolete, and the strange sounds they produce are no longer heard as frequently. However, for those who remember the days of dial-up, the sound of a modem connecting can be a nostalgic reminder of the early days of the Internet.
You mention in the 2nd paragraph error correction, what is error correction?
Error correction refers to the process of detecting and correcting errors during the transmission of data.  The most recent protocol appears to be the ITU (International Telecommunication Union) V.42 protocol included in most dialup modems.

It uses Link Access Procedure for Modems (LAPM), where the remote modem detects errors through cyclic redundancy checking (CRC) and requests re-transmission of corrupted data (ARQ).

It is important to note that this process takes place at the Level 2 or Data Link layer in the OSI model.