Is my high potassium due to my kidney not working good or just because I had taken too much potassium?

Multiple causes. Hi potassium can also be because the blood draw tube sat too long and cells released potassium. If your kidneys are working properly and you take no meds, your body should excrete all excess potassium. Ace inhibitors and spironolactone can elevate potassium.
Maybe. It depends on if you other health problems that cause your kidneys not to work good because high potassium (k) can be caused from bad kidneys but it can also be caused from dietary intake as well as some medications.