Alias expansion in a function is done when the function is read, not when the function is executed. The alias definition in the function is executed when the fucntionfunction is executed.
See Alias and functions
and https://www.gnu.org/software/bash/manual/html_node/Aliases.html
This means, the alias will be defined when function main is executed, but when the function was read for the first time the alias was not yet defined. So the first time function main will execute function Hi three times.
When you source the script for the second time, the alias is already defined from the previous run and can be expanded when the function definition is read. When you now call the function it is run with the alias expanded.
The different behavior occurs only when the script is sourced with . Sample.sh, i.e. when it is run in the same shell several times. When you run it in a separate shell as ./Sample.sh it will always show the behavior of the first run.