Original image from: median.com
This blog post is from an Indian Mechanical engineers perspective. Take it with a pinch of salt.
It's a simple question with a very simple answer. The answer is, "Programming is everywhere".
If you are a mechanical engineer and you think that only core mechanical syllabus is enough for you, then you are in for a shock. A famous saying (by me of course ) goes as, "An engineer with zero knowledge in programming is no engineer". That's for you as well.
So where do you use or where do you encounter programming?
As a Mechanical engineer you'll encounter programming when you want to earn the big bucks. A basic knowledge in any programming language will give an advantage over your peers in the industrial market.
To give you a real world idea,
FORTRAN codes are used in ANSYS APDL.
PERL scripts can be use in conjunction with CCL (a native programming language) in ANSYS CFX
Python scripts can be used to automate tasks in ANSYS WORKBENCH.
Visual C++ and Visual C# are used in creating add-ins and for SOLIDWORKS.
VBA is used in macro programming in CATIA.
AutoLISP, C++ are used in AutoCAD.
The above list gives you a rough idea on which programming language is used in production-centric software in the Mechanical domain.
As a bachelors degree pursuing student, if you are looking for opportunities, I suggest you to pick any one from the above list and gain good knowledge in that field.
My suggestion for a newbie would be to start from Python, as it an user-friendly programming language which is much easier to learn compared to others. It has its advantages and disadvantages. But for a newbie, the advantages far outweigh the disadvantages. We can summarize the advantages as,
Simple syntax. (You can read most of the code and understand what it does.)
No mandatory initiation. (Python scripts are dynamically typed, so there is no mandatory initiation of variables.)
Has excellent third party libraries. (If you are interested in dwelling deeper, you can easily learn Big-data analysis using python. Eg: Numpy, pandas, Tensorflow, etc...)
Simple setup. (Initial setup is simple. It's just a 30Mb file during installation.)
Great support. (If you have issues with your code, you can easily find assistance in the support communities. It has a thriving support community.)
Can be used in embedded system. (Micropython in embedded systems.)
Runs in almost any system and platform. (Even if you have potato computer, python can run in it.)
Free software. (Need I say more?)
I urge every mechanical engineer to pick a programming language to widen your opportunity while you search for a job. A simple certificate course for programming language can go a long way in your career. A final piece of advice is for you to start working in Linux platform if you are planning a career in Research field, you'll thank me later.
Some interesting links for budding Mechanical engineers:
Macro programming in CATIA: http://www.scripting4v5.com/additional-articles/
VBA for CATIA: https://v5vb.wordpress.com/
Python for beginners_1: https://www.tutorialspoint.com/python/index.htm
Python for beginners_2: https://www.w3schools.com/python/
I'm not affiliated to the above mentioned websites in anyway. It's just a suggestion from my part.