I got a cat a week ago off a friend and at first it was very scared and didn’t come out from under the sofa, in the past 2 days it has come out and plays with us. The cat is a house cat and has never been outside and is only 9 months old. I opened the window slightly when cooking and it went on the windowsill and tried to open the window even more. I picked the cat up but when I put it on the floor it tried to attack me I left it for 5 minutes in the kitchen to cool off and went back in and it seemed fine then 10 minutes later when I went back in it went crazy again and wouldn’t calm down and was trying to attack me. it has been over 2 hours since it happened but whenever I go in the room that it is in it will try and pounce and attack me. I have gone in another room to leave it alone but it doesn’t seem to be calming down.
This is generally normal cat behavior. Imagine your cat as a lion, resting and sleeping. When it senses movement, like an animal in the distance, it perks up and pounces. This is a sign that your cat is bored and wants to play. The cat is not being malicious, unless there is signs of hissing and your cat seems tense. (Which doesn't seem like the case.)
When it sees you moving, it thinks of you as that animal in the distance, much like it does with its toys. To avoid this, when the cat tries to attack you, get a toy instead and give it something funner to play with. That way, it learns to avoid attacking you and instead plays with toys on its own and reinforces the idea that you're not a toy.
The reason it's regularly recommended to adopt kittens in pairs is because they are extremely active and looking to play; as you have only a single kitten, you are now the target of that play activity. Knowingly or not, you assumed the role of "playmate" for this kitten when you took it in. Unless you're willing to get a second kitten (and go through a proper introduction between the two of them), you're going to have to fulfill that role.
Get some interactive toys (toys attached to strings on wands are good for this, or a laser pointer with proper consideration to how your cat may respond to it), and play with your kitten. You'll both find it fun, it will be a good way for the two of you to bond with each other, you'll help it burn off some of its kitten energy, and you'll help it redirect attention toward toys instead of your ankles.