Occasionally you may encounter issues with your Joy-Cons or controller.
To fix this, first select “Controllers” from the Home screen and ensure that your controller is connected. If not then you will be able to search for and pair them here.
Next, update the controller’s firmware via System Settings > Controllers and Sensors > Update Controllers.
Finally, recalibrate your controllers via System Settings > Controllers and Sensors > Calibrate Control Sticks and follow the on-screen instructions.
Unfortunately, if none of this helps then you may be experiencing “Joy-Con drift”. This is a known and regularly reported issue for Switch controllers. Nintendo have acknowledged the issue, and will repair your Joy-Cons for you. You can find out more about this here.