I don’t think there is any official restriction on it, the only courses that are usually restricted are the medicine related ones. You could always email the uni to check?
I did electives in first year for courses that were technically more competitive than mine. However, there are no guarantees you’ll be able to do your top choice of electives - there’s a chance the timetable might clash with compulsory chemistry modules or the course is full. You would also need to check what the compulsory first year courses are for mechanical engineering, is it just the engineering course or are there other requirements too? They will almost certainly need a maths course, which will probably be very similar to the chemistry maths course that you’ll be doing, but you would need to check if they are interchangeable.
If you meet the second year entry requirements for mechanical engineering anyway (despite going into first year chemistry), your chances for switching after first year are higher, as they are more likely to overlook requirements not being met exactly.