A bug in your code means a problem or error. To debug means to get rid of the error.
The term debugging came from Admiral Grace Hopper, a pioneer in computing. She was working on the Mark II computer at Harvard University in the 1940s and a moth got stuck in the computer and stopped it from working.
Getting rid of the moth, she said they were “debugging” the system. Programmers use the term now to mean “fixing errors in my code”.