sounds like your cleats are not adjusted properly.
first, sit on a table/chair with your legs dangling. Where do your feet point naturally? Out? Middle? In?
If they point out, adjust your cleat accordingly so that they sit at the same position when you are pedalling (leave enough float for your feet to swivel on the pedal as you spin).
The reason your knees hurt could be because your cleats are not adjusted properly. While pedalling, your feet could want to swivel in but is being restrained because most of the float is for swivelling out.