Is accepting Bitcoin as a gift save? I've got certain amount of mBTC from a person I don't know well (we've never met in person, although we chat online from time to time), in the form of them giving me the key for getting access to the wallet. They say, it's just a Christmas gift; and I don't see any obvious signs of scam here (they don't ask me to do anything in exchange and say that I don't owe anything).
But I'm still anxious, as in my world people don't give away money like that. I have only basic understanding of Bitcoin. Is it possible, that I'll run into trouble here? Like, if this person got these money through some illegal activities, could the trace lead now to me instead of them? What else should I look into? (besides our local laws regarding using cryptocurrency and paying taxes, I'm looking into it now)
in the form of them giving me the key for getting access to the wallet.

Something I associate with scams.
If this is an online wallet (custodial) this sort of thing is normally explicitly forbidden in the terms and conditions. And for good reasons.
If it is a more normal wallet, it is an idiotic way of donating money. That by itself is suspicious.

Is it possible, that I'll run into trouble here?

It is possible, but there's insufficient information to guess how unlikely it is.
Suppose that the wallet (key) is stolen or that money that is the proceeds of crime will be routed through it. It is possible that, having accessed or used the wallet you will be traced and held responsible for money laundering, handling stolen money or accused of complicity in crime.
Maybe they're hoping you don't know that changing the password won't lock them out of the wallet and that sometime in the future you'll add money to that wallet that they will then steal.
Maybe they're grooming you and will later ask you to perform some sort of favour for them involving the use of that wallet in a way that helps them but lands you with debt or a day in a police interview room?
Or it may be the donor is just appallingly inept. Or thinks you are?
In the end it doesn't matter, you don't have to work out the exact way they are trying to trick you. If it seems at all suspicious, keep well clear and don't get involved at all.
The only relatively safe way to accept Bitcoin as a gift is to download a popular respected wallet to a clean PC or phone, don't give anyone else any details at all about your wallet apart from a single-use bitcoin address they can transfer some amount of Bitcoin to. Never accept wallets or keys from other people.