Glossary
DerivedData
Xcode's build cache: indexes, module caches, and intermediate products that the next build can recreate.
DerivedData is the directory Xcode uses for a project's generated build state. Indexes, precompiled modules, and intermediate build products land there so the next compile can reuse them. The usual location is ~/Library/Developer/Xcode/DerivedData. Your source tree is not stored there.
Removing it does not delete the project. It makes the next build slower, because Xcode reconstructs the cache. Disk Housekeeper Smart Clean can include DerivedData. You get a preview first, and the removal goes to the Trash by default. See Clear Xcode DerivedData.
Where Xcode DerivedData is, and how big it gets
The default path is ~/Library/Developer/Xcode/DerivedData, with one subfolder per project or workspace. Each can run to several gigabytes, and folders for projects you no longer open are never removed. Xcode shows and lets you change the path in Settings > Locations.
Questions
What is DerivedData in Xcode?
It is the folder where Xcode keeps build products, indexes and module caches for each project, so the next build can reuse them.
Is it safe to delete Xcode DerivedData?
Yes. Your source code is not stored there. Xcode rebuilds the folder, and the first build afterwards is slower.
Where is the DerivedData folder?
At ~/Library/Developer/Xcode/DerivedData unless you changed it in Xcode's Settings > Locations.