They both mean the same, "because".
"Kasi" is informal. "Dahil" is formal.
Dahil is always correct to use but would sound awkward when used in some informal conversations (e.g. talking to very close friends).
However, this rule is always true: when the latter part of the compound sentence (after the conjunction "because") is a dependent clause (not a complete sentence), you should always use "dahil".
Example:
He tripped because he ran fast.
"He ran fast" is an independent clause that still conveys a complete thought when removed from the compound sentence. In this case, you can use either "kasi" or "dahil". "Dahil" is more appropriate for formal conversation/writing.
Siya ay nadapa dahil tumakbo siya ng mabilis.
Siya ay nadapa kasi tumakbo siya ng mabilis.
He tripped because of his fast run.
"His fast run" is not a complete sentence and would only make sense when part of the compound sentence. It is a dependent clause. In this case, ALWAYS use "dahil".
Nadapa siya dahil sa kanyang mabilis na pagtakbo.
He was wounded because when he ran fast, he tripped.
"when he ran fast, he tripped" conveys a complete thought. Thus, an independent clause. You can use "kasi" or "dahil" in this case again.
Nasugatan siya dahil sa pagtakbo niya ng mabilis, nadapa siya.
Nasugatan siya kasi sa pagtakbo niya ng mabilis, nadapa siya.