Well, this is a very large topic. The basics is that Bitcoin (and most cryptos) are what we call semi-anonymous. What does this mean? It means that the transactions are traceable (they are on the blockchain), but the owner of the wallet is not identified. So, you have a situation where transactions can be traced, but not necissarily linked to a spesific person.
When you exchange crypto︀ to fiat or fiat to crypto, the exchanger will normally want to know who you︁ are. In the EU, they are now required to know as this type of service︂ is under the EU AML/KYC directive. So, here you will be identified unless you do︃ this is private or find a supplier that does this for you.
IP addresses are︄ not recorded as such, but all centralised exchages (at least in the EU) have a︅ software that traces your IP among other things. This is becuase they have to have︆ a way to trace suspicious transactions (AML requirement). Luckily there is also GDPR. So, the︇ total effect is that your IP is traced but not recorded over time.
It is,︈ of course, possible to stay more or less anonymous using Bitcoin, and in reality governments︉ do not have the systems or resources to trace you unless there is an ongoing︊ investigation.