If you need to transfer your data from an old phone to a new one, there are a few ways to do it. First of all, check to see if your data is already being synced to the cloud. Data such as email, contacts, and calendars are likely already stored with Google or Apple's iCloud. You can verify this by logging into your Google or Apple account from a web browser and checking to see if the data is there.
If you're coming from a much older phone, or if your phone isn't fully functional, you might be able to access your data by connecting it to a computer via USB. Upon connecting it, Windows should recognize it and mount it as an external drive. If you're on a Mac, you'll need the Android File Transfer App first.
Once the phone is visible on your computer, you'll be able to browser through the folders of your phone. Keep in mind, Android isn't meant to be used in this way, so the folder names may look foreign to you. You'll have to dig around to find everything, and you may even want to just copy all of the folders over to your computer hard drive to be safe.
If you're coming from a Samsung Galaxy phone in particular, this page at fonepaw.com will show you how to recover deleted contacts.