Can I turn my Android tv box into a NAS server?
It'll surely be easier if you set up a GNU/Linux system on the box.

There's a very popular NAS software on Linux named "samba", and is available everywhere from built-in repositories, i.e. you can install it with sudo apt-get install samba or sudo yum install samba. Bunches of tutorials about it are available on the Internet. However that good job does not have an Android port :)

For setting up Apple Time Capsule, I used to learn that it's possible but I don't know if it's still possible now. You should search online instead of asking here &ndash; it's blatantly off-topic on Android Stack Exchange. Maybe you want to ask on Ask Different?