So I got SSD with macOS X on it and HDD with just files. Can I install Debian on the second one as second OS and still use HDD as storage when using macOS?
There should be no reason why this would not be possible. Your Debian is going to need it's own partition(s) and you need to choose how much space you want to give to the Debian installation. How much space you want to leave for OS X storage, is up to you, however the Debian root partition is going to need some dedicated space.
There are several ways to go about this, and one thing worth considering is if you need a file system partition writeable from both OSes (it is possible, but you didn't specifically ask for it, so I'm not going to answer that).
In a nutshell, I'd go about it like this:
- Re-partition the HDD from OS X. Reduce the size of the storage partition so that you have unprovisioned space left for Debian installation.
- Install Debian (or any other Linux distribution of your choice)
- If Debian can not install a working boot manager for you, install ReFind afterwards. I've found it working best for dual-bootin Linux / OS X.