Compost I rotted organic matter (leaves, vegetable kitchen scraps, egg shells, etc) and is used to improve the texture and nutritional value of the soil.
Fertilizer is a combination of nutrients concentrated so that it can be added to the soil to improve the nutritional value of the soil.
Neither is “better” and it is best to use both to improve the soil. I prefer organic fertilizer and strongly suggest its use.