Try one thing listed below at a time. If you do something and it fixes it, you don't want to have to wonder which of the three things you did at the same time was the solution. In other words, change one thing and test. If it doesn't fix it, put it back the way it was and change a different thing. This is how you isolate the cause. A problem can be caused by multiple things feeding on each other. So once you're exhausted changing/testing individual things you may need to advance to trying multiples. e.g., if you have a bad connector on your USB cable, the cable will need to be replaced. But while you were using that cable with the bad connector, it could have damaged the plug you were inserting it into in your computer. This is a case where you have two problems intermixed.
Anyway, some things to try:
Try a different USB port on your computer. If you are using a front USB port, try a port on the back (they often times use different controllers between front and back). If the usb cable connected to the drive is removable, try a different cable. Make sure all cable connections are firm and tight. Some external drives may be powered by just the USB port, while others require an external power cord. If your drive has a place to connect external power and you are not using that, connect the power cord. It is possible a drive that requires external power may kindof/sometimes almost work without that external power. Then you plug it in on a different occasion and it doesn't work reliably. I would recommend that if a drive comes with an external power cord, always use that cord even if it may appear optional to you. USB ports on a computer can and do put out different levels of power. Some may work powering a particular external drive, but others may not.
If you're running Windows, reboot the computer. That is actually the first thing you should try for any Windows computer problem. I should have mentioned this first.
If you know where to find them, look at system logfiles for warnings and errors. I'm assuming that you run Windows. I run Linux, so I can't tell you where to go to review system logs on modern versions of Windows.
You can also review SMART data for our drive. Do all the other stuff above first - interpreting SMART data is not easy. SMART has to be enabled and you need to run software to view the data. Again, assuming Windows, I'm at a loss to tell you where/how you use SMART on that OS. The data is the same as I'd see on Linux, but how you access it is different.