Ordinary vegetable oils of the type used for cooking will work but are not ideal. Over time they will gradually oxidise and may be colonised by bacteria, both of which can cause them to become acidic which can itself cause corrosion of the metal. Also vegetable oils can become gummy and sticky in quite a short period of time.
Oils help to prevent corrosion by excluding moisture and oxygen from the metal surface. All metals will form a thin layer of oxide on the surface and oil etc can penetrate into this, helping to stabilise it and prevent destructive corrosion.
It's also worth adding that carbon steels will naturally form a blue/grey layer of oxide on the surface and this is not necessarily a bad thing as it can provide a porous surface which can be pretty durable when stabilised with oil or wax.
The best protective oil for a given situation will depend exactly on what you want to achieve. A light oil like 3-in-1 or gun oil is easy to apply and remove and can also be useful as a cleaning agent to remove wood resin etc from a blade. The downside is that its relatively low viscosity means that the protective film formed isn't very durable and so may not be ideal for long term storage or protection during use.
Wax like renaissance wax or simply rubbing with a candle will give a more durable protective film but may need more care in applying to get a thorough coating. Wax can also help to lubricate saws.
Another alternative is grease, this is easy, if potentially messy to apply but should give very good long term protection during storage as it can form a much thicker layer than oil. There are specialist greases for storing metal items which also contain active additional corrosion inhibiting ingredients, although these can be difficult to remove before use. Grease tends to be most useful if something needs to be stored for a significant time in bad conditions.
There is also the consideration that if a tool is to be used for food preparation any protective coating should be reasonably food-safe.
There are also a range of other substances such as silicone or PTFE based greases which can provide some protection from rusting and are available in spray on form. Some of these are intended to leave a dry film which is less prone to attracting dirt and grit and may be an advantage for tools such as folding knives with exposed moving parts.
Overall I would say :
Oil is good for routine maintenance of frequently used tools, eg wiping on a thin film after use or for tools with complex assemblies or moving parts where penetration into small spaces is required.
Wax is good for storage of occasionally used tools in reasonably good conditions. Or if a tool is being used outdoors in wet weather.
Grease is good for long term storage in poor conditions eg tools only used for part of the year and kept in a shed.
Tools with fine mechanisms may benefit from dry film lubricants to reduce teh risk of attracting grit etc.