According to Daniel 6, Daniel was cast into the den of lions because he continued to pray to God in defiance of a royal decree. King Darius had been persuaded by Daniel's jealous rivals to sign an irrevocable decree stating that for thirty days, anyone who prayed to any god or man other than the king would be thrown into the lions' den.
Despite knowing the decree had been signed, Daniel went to his upper room and knelt to pray three times a day, giving thanks to God just as he had always done (Daniel 6:10). His enemies observed him praying, reported him to the king, and the king was compelled to enforce the decree. Daniel was therefore cast into the den because he prayed to God rather than comply with the decree.
Daniel was not disloyal to the king in any genuine sense; King Darius himself valued Daniel highly and tried to find a way to save him (Daniel 6:14). Daniel was not a criminal, and while he was of foreign origin (a Jewish exile from Judah), his nationality was not the reason for his punishment. The cause was his faithfulness in continuing to pray to God despite the royal prohibition.