Yikes, man ...sorry that happened!
1. Likely happened because of either undue torque at you screwing in the screwhead (maybe angling the screwdriver instead of squarely on the head?), or the pilot hole is too small for the screw and thus the screw was binding as it tried to "cut" into the wood. I mention this only so that once you fix the one offending screw, you "may" want to use the next larger bit (check carefully as you may
not want to). Remember that this screw does nothing to "hold" the tuning machine in place as that's accomplished by the nut at the top. The screw is only a "locating" screw that helps prevent the body twisting: it needs only a mild anchoring and it's a happy camper

2. Bit Extractor (aka "easy out") you can find at any Home Depot/Lowes' tool dept. You'll clearly need the smallest extractor possible. Be careful ...maybe someone holding the guitar and neck firmly in place as you perform this careful task will be required. Steady hand, my friend

3. Once the broken piece is out, you may be able to get away without doing a "drill-n-fill." If the screw comes out cleanly, the hole in the wood is largely intact. So it may be ok to receive a new screw, or if not, drill one size larger and go in with the new screw.
Hope this helps ...post your victory, I hope!!
Edward