My bike has a switch mounted in the same way. The PO had it wired to 'blue' accessory lights. I left it there except to replace with a longer handled switch and added more lights.Definitely not a stock switch.
It could be for thousands of things from aftermarket lights to factory functions that the previous owner wanted separate control over.
If I were in your shoes, I honestly would cut the switch from the wires (to make it easy to pull the wires and trace where they're connected - plus that switch looks like it has seen better days).
The only caveat I recommend would be to flip that switch once or twice while the bike is running. Just to make sure it's not something critical like a kill switch.