It could be because file transfer has not been enabled on your iPhone. When you connect your phone to your computer, swipe down from the top of the screen and see if it offers a list of options for what to do with the connection. Data transfer should be one of the options.
Either the RAM on your system is faulty or the slot that the RAM is installed in is faulty. To check your RAM, use the Windows Memory Diagnostics utility. Open the utility by pressing the Win + R key combination and enter mdsched in the Run box. Then follow the prompts provided by the utility. If Windows Memory Diagnostics does not see a problem with your RAM, then the problem may be with the RAM slot on your motherboard instead, and your motherboard may need to be replaced.
If the problem started when you downloaded an apk file, then it may be caused by malware. The fact that a factory reset didn’t fix the problem is curious. Perhaps running several antivirus programs on your device (Malwarebytes, Bitdefender, Kaspersky, etc) one after the other may clean it of the offending software.
Checking your computer’s Event Viewer (eventvwr.msc) may offer clues. In the Event Viewer window, go to the upper left-hand corner and double-click “Custom Views”. Then click “Administrative Events”. Scroll through the entries that appear to find any that might be related to your graphics card. In some situations, an outdated BIOS could be causing a specific issue with a device that's making it report an issue to Windows, so updating your BIOS/UEFI may help. You may have to replace your graphics card, but before you do, try re-seating it in its slot to see if that helps before you spend any money.
One way to diagnose the cause is to run Apple Diagnostics (Apple Hardware Test) on your MacBook. To access the utility, turn on the computer and immediately press and hold the D key until a screen appears asking you to select your language. Choose your language and follow the on-screen prompts. The MacBook should run a diagnostic test on itself and tell you what hardware component needs replacing.
Is the USB plug for your new charging cord exactly the same size/shape as the old ones you used to have? Certain phones only take certain size/shape charging cord plugs. You may have to use a different charging cord or upgrade your phone to one that takes that specific type of USB plug.
Try resetting your network settings. This can be done in the Settings app on your device. Head to Settings > General > Reset > Reset Network Settings. Note this may erase all the passwords from your phone.