There are different types of insulin and insulin regimes. Timing of your dose with respect to food depends on the type of insulin.
For example, slow acting insulin does not need to be taken with (neither before nor after) food. This is a background insulin which manages the constant drip of glucose from your liver.
Fast acting insulin is intended to stop the bg peaks from the carbs in your food. Different foods breakdown at different rates. Injected fast acting insulin takes time to start to act (typically 15 minutes or more although it depends on the person). The aim is for the peak of the fast acting insulin action to correspond with the time the carbs in your food become glucose in your blood. To reduce bg spikes. The usual advice for this is to take fast acting insulin 15 to 20 minutes before your meal.
Then, there is mixed insulin. I have never taken this but understand timing is unrelated to eating.
To answer the question in short, it depends.