Black bars appear on the sides of your video when the aspect ratio of your video doesn't match the aspect ratio of YouTube. YouTube uses a 16:9 aspect ratio, which means the width of the video is 16 units and the height is 9 units. If your video has a different aspect ratio, such as 4:3 or 9:16, YouTube will add black bars to fill the empty space.
To remove black bars from your video, you need to crop or resize your video to fit the 16:9 aspect ratio before uploading it to YouTube. There are different ways to do this depending on the software or tool you use.