WorkflowSim is a toolkit for simulating scientific workflows in distributed environments. It models workflow overhead, failures, and the hierarchical nature of workflows with tasks and jobs. WorkflowSim extends CloudSim to be workflow-aware and supports modeling diverse overhead distributions, failure models, and fault tolerant techniques like reclustering and job retry. It helps researchers evaluate workflow optimization techniques more accurately. Validation experiments show WorkflowSim can accurately simulate overhead and failures and their impact on workflow scheduling heuristics and fault tolerant clustering approaches.