Unfortunately, it is not the fan that needs attention.....it is the internal hard drive.....which has failed.
It's a really difficult.....and somewhat dangerous.....job to open up the Time Capsule to pull the hard drive to replace it, but that is what will need to be done. Best if this is done by a repair shop since Apple did not design the product for service.
We say "dangerous" because it is very easy to break a connector or tear a ribbon cable during the process, since it has a strong tendency to self destruct when the case is opened up to remove the electronics.
Repairs to the hard drive are only for the pros to attempt.....Cost is upwards of $1,000 to try to save the data on the drive, so simply replacing the hard drive is probably the way to go if you can afford to start over again with new backups.
The Apple forum moderators usually pull any specific instructions that we provide to repair the Time Capsule by replacing the hard drive, but you can probably find information about this using a Google search.
If the Time Capsule is 5+ years old, repairs are not really advised because the power supply is also due to fail about this time.