Hey there, mirela76,
Thanks so much for using Apple Support Communities.
This definitely sounds unanticipated but we want to help you figure out what might be going on. To start, is your iPhone running the latest version available of iOS? This can seem simple but oftentimes an update will resolve these types of issues so we do think it's worth trying. Here's how: Update your iPhone or iPad - Apple Support
If that doesn't quite do it, then we would also recommend that you test the issue out with a different USB cable. If it's still happening then test it again using a different USB port, if possible. This can help isolate the issue, showing us whether the issue may be due to a malfunctioning USB port or cable.
We hope that this information is helpful.
Have a great day!