I tried connecting my guitar via usb in my pc and I get electric shock from the strings what might bne the problem?
If you connected i t directly is no a estrange thing. A USB port have a small amount of electricity (to power devices and stuff). If you connect a guitar this current would go up your cable into your pickups, then, they will produce a strong mantic field charging your strings.... and if you play SHOCK!.... If you plan to record you need an interface to record your guitar. If you have one, your USB might have a problem or your cable, or a grounding problem in your guitar
Keep doing what you're doing and make a death metal band called "Deathshock"