Hi Grzywciak,
Thanks for coming to Apple Support Communities for help today. It sounds like you are concerned your account has been compromised.
If you have two-factor authentication for your Apple ID, this is absolutely the best protection. You can see an example of a pop up message you'd receive if someone tried signing into your Apple ID: Two-factor authentication for Apple ID.
If you received this message in an email or SMS text, it's possible these were phishing attempts: Recognize and avoid phishing messages, phony support calls, and other scams or it could be a two-factor code being sent over SMS: Get a verification code and sign in with two-factor authentication.
If it was an attempt at signing in on another device and you have two-factor on your account, it would seem to be working as it should to protect your account.
Changing your password is a recommended step if you fear your account has been compromised: If you think your Apple ID has been compromised. Based on what you have told us, this doesn't seem to be the case, but please review the article.
Have a fantastic day!