Are cognitive biases "hardcoded" into our brain or learned? And have they evolved over time e.g. more cognitive biases could emerge evolutionally?
Either, depending on the bias. For example, the Müller-Lyer illusion could well have some significant learned aspects (how much is debated). Categorical perception of phonemes is a kind of bias, I guess, that's definitely mostly learning. At the other end of the spectrum supposedly 'irrational' context effects in decision making have been observed in slime molds, those are probably universal (so they're probably also adaptive).
In general it's probably not very useful to split cognition into 'biases' and 'the rest'. Maybe think of cognition as a memory system (with some flaws and a salience-not-probability weighting scheme) a reasoning/decision system (with limited resources and high time pressures) a perceptual system (facing a fundamentally underspecified problem) etc etc... the 'biases' are not really distinct processes. From that framing the question is hard to answer. If you singled out a particular bias, probably someone here could tell an evo story about how it came to be though! Maybe even a plausible one.
Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.