How is not important at this stage, you need to deal with the threat, its possible they have access to your whole PC, files, network, everything (they may have made copies too)
Either you clicked on something or installed something spurious. Or they are on your network and they have access to your PCs directory. - the weakest link in any network are the users, think about what happened, what could have caused it and that's your solution for it to not happen again (what did you install, what did you click on? etc...)
Change all WiFi passwords (disable that shitty easy connect WPS thing). disconnect your PC from any network, back up important files format all drives, reinstall OS.
That's kinda cool...