What determines how hard or soft a cheese will be?
It is mostly about how much water is left in the curd- how hard and long you press it, aging, and sometimes microbial growth.

Soft cheeses like cream cheese are only barely pressed. Fresh soft cheeses like queso fresco and paneer aren't even pressed at all- just hung to dry.

Cheddar is pressed firmly and aged for a relatively short time.

Cheeses like parmesan are pressed firmly and then aged for months to over a year. Most of the liquid leaves during pressing and then they also dry considerably.

Some cheeses like Camembert are unique in that the mold that grows on them softens them as it digests compounds in the cheese. This is what gives Brie, etc, their unique texture.